From: David Zafman Date: Fri, 13 Dec 2019 03:42:10 +0000 (-0800) Subject: Partially revert "mgr/balancer: balance pools with same crush_rule in batch" X-Git-Tag: v14.2.8~20^2~18^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c97fe42ab02ece255c3c948c34bfd3ab1f62934d;p=ceph.git Partially revert "mgr/balancer: balance pools with same crush_rule in batch" This partially reverts commit 3a730d751deff892e7a0bddba87eba3dbb829c3e Fixes: https://tracker.ceph.com/issues/43307 Signed-off-by: David Zafman (cherry picked from commit 7a1d6872c74a03b2493ecef0f2c4a5f9656a7c5e) Conflicts: src/pybind/mgr/balancer/module.py (No active+clean handling) --- diff --git a/src/pybind/mgr/balancer/module.py b/src/pybind/mgr/balancer/module.py index ca9cb7a6090..2688bebf715 100644 --- a/src/pybind/mgr/balancer/module.py +++ b/src/pybind/mgr/balancer/module.py @@ -947,7 +947,11 @@ class Module(MgrModule): detail = 'No pools available' self.log.info(detail) return -errno.ENOENT, detail + # shuffle pool list so they all get equal (in)attention + random.shuffle(pools) + self.log.info('pools %s' % pools) + adjusted_pools = [] inc = plan.inc total_did = 0 left = max_iterations @@ -955,7 +959,6 @@ class Module(MgrModule): pools_with_pg_merge = [p['pool_name'] for p in osdmap_dump.get('pools', []) if p['pg_num'] > p['pg_num_target']] crush_rule_by_pool_name = dict((p['pool_name'], p['crush_rule']) for p in osdmap_dump.get('pools', [])) - pools_by_crush_rule = {} # group pools by crush_rule for pool in pools: if pool not in crush_rule_by_pool_name: self.log.info('pool %s does not exist' % pool) @@ -963,15 +966,11 @@ class Module(MgrModule): if pool in pools_with_pg_merge: self.log.info('pool %s has pending PG(s) for merging, skipping for now' % pool) continue - crush_rule = crush_rule_by_pool_name[pool] - if crush_rule not in pools_by_crush_rule: - pools_by_crush_rule[crush_rule] = [] - pools_by_crush_rule[crush_rule].append(pool) - classified_pools = list(pools_by_crush_rule.values()) + adjusted_pools.append(pool) # shuffle so all pools get equal (in)attention - random.shuffle(classified_pools) - for it in classified_pools: - did = ms.osdmap.calc_pg_upmaps(inc, max_deviation, left, it) + random.shuffle(adjusted_pools) + for pool in adjusted_pools: + did = ms.osdmap.calc_pg_upmaps(inc, max_deviation, left, [pool]) total_did += did left -= did if left <= 0: