]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/balancer: skip CRUSH_ITEM_NONE
authorSage Weil <sage@redhat.com>
Mon, 13 Nov 2017 01:49:02 +0000 (19:49 -0600)
committerSage Weil <sage@redhat.com>
Mon, 13 Nov 2017 14:16:52 +0000 (08:16 -0600)
Signed-off-by: Sage Weil <sage@redhat.com>
src/pybind/mgr/balancer/module.py
src/pybind/mgr/mgr_module.py

index b8cc087b9e8b8edaf446e999e82902e934165370..fb514143da34f4e18fb1ec3c8881a60dd5cd62e3 100644 (file)
@@ -11,6 +11,7 @@ import random
 import time
 from mgr_module import MgrModule, CommandResult
 from threading import Event
+from mgr_module import CRUSHMap
 
 # available modes: 'none', 'crush', 'crush-compat', 'upmap', 'osd_weight'
 default_mode = 'none'
@@ -19,7 +20,6 @@ default_max_misplaced = .05    # max ratio of pgs replaced at a time
 
 TIME_FORMAT = '%Y-%m-%d_%H:%M:%S'
 
-
 class MappingState:
     def __init__(self, osdmap, pg_dump, desc=''):
         self.desc = desc
@@ -451,6 +451,8 @@ class Module(MgrModule):
                     bytes_by_osd[osd] = 0
             for pgid, up in pm.iteritems():
                 for osd in [int(osd) for osd in up]:
+                    if osd == CRUSHMap.ITEM_NONE:
+                        continue
                     pgs_by_osd[osd] += 1
                     objects_by_osd[osd] += ms.pg_stat[pgid]['num_objects']
                     bytes_by_osd[osd] += ms.pg_stat[pgid]['num_bytes']
index 4de0a33594c578f66a3454b88b77c87ad9d8f20a..948cdeb5c20c4579b488350e1fc1cecc012520ec 100644 (file)
@@ -126,6 +126,8 @@ class OSDMapIncremental(ceph_module.BasePyOSDMapIncremental):
         return self._set_crush_compat_weight_set_weights(weightmap)
 
 class CRUSHMap(ceph_module.BasePyCRUSH):
+    ITEM_NONE = 0x7fffffff
+
     def dump(self):
         return self._dump()