Skip to content

Commit

Permalink
pybind/mgr/balancer: skip out/crush-out osds
Browse files Browse the repository at this point in the history
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
(cherry picked from commit 201fc98)
  • Loading branch information
xiexingguo committed Mar 10, 2018
1 parent dcdeae3 commit 68d9c88
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/pybind/mgr/balancer/module.py
Expand Up @@ -426,7 +426,7 @@ def calc_eval(self, ms, pools):
self.log.debug('pool_rule %s' % pool_rule)

osd_weight = { a['osd']: a['weight']
for a in ms.osdmap_dump.get('osds',[]) }
for a in ms.osdmap_dump.get('osds',[]) if a['weight'] > 0 }

# get expected distributions by root
actual_by_root = {}
Expand All @@ -450,10 +450,11 @@ def calc_eval(self, ms, pools):
roots.append(root)
weight_map = ms.crush.get_take_weight_osd_map(rootid)
adjusted_map = {
osd: cw * osd_weight.get(osd, 1.0)
for osd,cw in weight_map.iteritems()
osd: cw * osd_weight[osd]
for osd,cw in weight_map.iteritems() if osd in osd_weight and cw > 0
}
sum_w = sum(adjusted_map.values()) or 1.0
sum_w = sum(adjusted_map.values())
assert sum_w > 0
pe.target_by_root[root] = { osd: w / sum_w
for osd,w in adjusted_map.iteritems() }
actual_by_root[root] = {
Expand Down

0 comments on commit 68d9c88

Please sign in to comment.