From: xie xingguo Date: Mon, 12 Mar 2018 00:57:18 +0000 (+0800) Subject: pybind/mgr/balancer: add sanity check against empty adjusted_map X-Git-Tag: v13.1.0~557^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=10a752671af71c7b6db168d75b0b416de85992d3;p=ceph.git pybind/mgr/balancer: add sanity check against empty adjusted_map E.g., because all OSDs are marked as **out**. Signed-off-by: xie xingguo --- diff --git a/src/pybind/mgr/balancer/module.py b/src/pybind/mgr/balancer/module.py index bc0dd0d73d5..807c521f621 100644 --- a/src/pybind/mgr/balancer/module.py +++ b/src/pybind/mgr/balancer/module.py @@ -463,7 +463,7 @@ class Module(MgrModule): for osd,cw in weight_map.iteritems() if osd in osd_weight and cw > 0 } sum_w = sum(adjusted_map.values()) - assert sum_w > 0 + assert len(adjusted_map) == 0 or sum_w > 0 pe.target_by_root[root] = { osd: w / sum_w for osd,w in adjusted_map.iteritems() } actual_by_root[root] = {