From a6955769ba65b7d565e1236ff8a94ca756177b3f Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Mon, 12 Mar 2018 08:57:18 +0800 Subject: [PATCH] pybind/mgr/balancer: add sanity check against empty adjusted_map E.g., because all OSDs are marked as **out**. Signed-off-by: xie xingguo (cherry picked from commit 10a752671af71c7b6db168d75b0b416de85992d3) --- src/pybind/mgr/balancer/module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pybind/mgr/balancer/module.py b/src/pybind/mgr/balancer/module.py index 1135bc4224722..b9a318b90ad36 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] = { -- 2.39.5