Skip to content

Commit

Permalink
mgr/balancer: simplify pool_info tracking
Browse files Browse the repository at this point in the history
Signed-off-by: Sage Weil <[email protected]>
  • Loading branch information
liewegas committed Nov 1, 2017
1 parent 2c300bc commit a59a1df
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/pybind/mgr/balancer/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,11 +377,13 @@ def plan_rm(self, name):
def calc_eval(self, ms):
pe = Eval(ms)
pool_rule = {}
pool_info = {}
for p in ms.osdmap_dump.get('pools',[]):
pe.pool_name[p['pool']] = p['pool_name']
pe.pool_id[p['pool_name']] = p['pool']
pool_rule[p['pool_name']] = p['crush_rule']
pe.pool_roots[p['pool_name']] = []
pool_info[p['pool_name']] = p
pools = pe.pool_id.keys()
if len(pools) == 0:
return pe
Expand Down Expand Up @@ -433,9 +435,7 @@ def calc_eval(self, ms):
self.log.debug('target_by_root %s' % pe.target_by_root)

# pool and root actual
for pool in pools:
pi = [p for p in ms.osdmap_dump.get('pools',[])
if p['pool_name'] == pool][0]
for pool, pi in pool_info.iteritems():
poolid = pi['pool']
pm = ms.pg_up_by_poolid[poolid]
pgs = 0
Expand Down

0 comments on commit a59a1df

Please sign in to comment.