From: xie xingguo Date: Tue, 30 Jan 2018 08:58:33 +0000 (+0800) Subject: pybind/mgr/balancer: fix sanity check against minimal pg numbers per pool X-Git-Tag: v12.2.5~81^2~15 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5869999083df1e58fc6590f85fcd497ed7f2898b;p=ceph.git pybind/mgr/balancer: fix sanity check against minimal pg numbers per pool And rename some variables properly. Signed-off-by: xie xingguo (cherry picked from commit cdae240ed9bd667c13a3afdebc25eb3649ce3503) --- diff --git a/src/pybind/mgr/balancer/module.py b/src/pybind/mgr/balancer/module.py index cd63b53a710..f21805ba0e1 100644 --- a/src/pybind/mgr/balancer/module.py +++ b/src/pybind/mgr/balancer/module.py @@ -711,12 +711,14 @@ class Module(MgrModule): random.shuffle(roots) for root in roots: pools = best_pe.root_pools[root] - pgs = len(best_pe.target_by_root[root]) - min_pgs = pgs * min_pg_per_osd - if best_pe.total_by_root[root] < min_pgs: + osds = len(best_pe.target_by_root[root]) + min_pgs = osds * min_pg_per_osd + if best_pe.total_by_root[root][key] < min_pgs: self.log.info('Skipping root %s (pools %s), total pgs %d ' '< minimum %d (%d per osd)', - root, pools, pgs, min_pgs, min_pg_per_osd) + root, pools, + best_pe.total_by_root[root][key], + min_pgs, min_pg_per_osd) continue self.log.info('Balancing root %s (pools %s) by %s' % (root, pools, key))