]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/balancer: fix available pgs sent to calc_pg_upmaps 38206/head
authorDan van der Ster <daniel.vanderster@cern.ch>
Fri, 20 Nov 2020 10:43:46 +0000 (11:43 +0100)
committerDan van der Ster <daniel.vanderster@cern.ch>
Fri, 20 Nov 2020 11:09:43 +0000 (12:09 +0100)
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>
src/pybind/mgr/balancer/module.py

index 5fffe01dcb054faa7b5b6dda3e30b917fe984669..acdf936b65e0f8648e529c7e2ccb8442d3b198d6 100644 (file)
@@ -1005,10 +1005,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
 
@@ -1023,7 +1021,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