From: Dan van der Ster Date: Fri, 20 Nov 2020 10:43:46 +0000 (+0100) Subject: mgr/balancer: fix available pgs sent to calc_pg_upmaps X-Git-Tag: v15.2.9~57^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F38337%2Fhead;p=ceph.git 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) --- 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