]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/balancer: fix available pgs sent to calc_pg_upmaps 38337/head
authorDan van der Ster <daniel.vanderster@cern.ch>
Fri, 20 Nov 2020 10:43:46 +0000 (11:43 +0100)
committerKonstantin Shalygin <k0ste@k0ste.ru>
Mon, 30 Nov 2020 11:32:20 +0000 (14:32 +0300)
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 <daniel.vanderster@cern.ch>
(cherry picked from commit 191d9fa4ab598c9e5b693fae4c2a4f3cc64faa68)

src/pybind/mgr/balancer/module.py

index 7cde23ed811f11d483d0678a04b0d13c823e450d..d76c255b0331e1d30f30a7da08370a26db205443 100644 (file)
@@ -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