From ef40cad451556b29d8aa1dccb082c7cf4a69683c Mon Sep 17 00:00:00 2001 From: Dan van der Ster Date: Fri, 20 Nov 2020 11:43:46 +0100 Subject: [PATCH] mgr/balancer: fix available pgs sent to calc_pg_upmaps Fix the calculation of how many PGs are available to be balanced each iteration. Fixes: https://tracker.ceph.com/issues/48309 Signed-off-by: Dan van der Ster (cherry picked from commit 191d9fa4ab598c9e5b693fae4c2a4f3cc64faa68) --- src/pybind/mgr/balancer/module.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pybind/mgr/balancer/module.py b/src/pybind/mgr/balancer/module.py index 7cde23ed811..d76c255b033 100644 --- a/src/pybind/mgr/balancer/module.py +++ b/src/pybind/mgr/balancer/module.py @@ -1006,10 +1006,8 @@ class Module(MgrModule): random.shuffle(adjusted_pools) pool_dump = osdmap_dump.get('pools', []) for pool in adjusted_pools: - num_pg = 0 for p in pool_dump: if p['pool_name'] == pool: - num_pg = p['pg_num'] pool_id = p['pool'] break @@ -1024,7 +1022,7 @@ class Module(MgrModule): if s['state_name'] == 'active+clean': num_pg_active_clean += s['count'] break - available = left - (num_pg - num_pg_active_clean) + available = min(left, num_pg_active_clean) did = plan.osdmap.calc_pg_upmaps(inc, max_deviation, available, [pool]) total_did += did left -= did -- 2.47.3