]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr/balancer: add sanity check against empty adjusted_map 20359/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>
Thu, 15 Mar 2018 07:20:29 +0000 (15:20 +0800)
E.g., because all OSDs are marked as **out**.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
(cherry picked from commit 10a752671af71c7b6db168d75b0b416de85992d3)

src/pybind/mgr/balancer/module.py

index 1135bc4224722ddc9e7229cdb2ded431419ce90b..b9a318b90ad361688076aab4c5a5d0fdf61a0077 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] = {