]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr/balancer: add sanity check against empty adjusted_map 20836/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Mon, 12 Mar 2018 00:57:18 +0000 (08:57 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Mon, 12 Mar 2018 00:57:18 +0000 (08:57 +0800)
E.g., because all OSDs are marked as **out**.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/pybind/mgr/balancer/module.py

index bc0dd0d73d5c739af4de7099774594958ce1da57..807c521f6212fc406817071bc6331cdf941703a9 100644 (file)
@@ -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] = {