From e2cbb4bc7a2badc3ff89fb4bf4d678d8e9f94652 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sun, 12 Nov 2017 19:49:02 -0600 Subject: [PATCH] mgr/balancer: skip CRUSH_ITEM_NONE Signed-off-by: Sage Weil --- src/pybind/mgr/balancer/module.py | 4 +++- src/pybind/mgr/mgr_module.py | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pybind/mgr/balancer/module.py b/src/pybind/mgr/balancer/module.py index b8cc087b9e8..fb514143da3 100644 --- a/src/pybind/mgr/balancer/module.py +++ b/src/pybind/mgr/balancer/module.py @@ -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'] diff --git a/src/pybind/mgr/mgr_module.py b/src/pybind/mgr/mgr_module.py index 4de0a33594c..948cdeb5c20 100644 --- a/src/pybind/mgr/mgr_module.py +++ b/src/pybind/mgr/mgr_module.py @@ -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() -- 2.39.5