From cdae240ed9bd667c13a3afdebc25eb3649ce3503 Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Tue, 30 Jan 2018 16:58:33 +0800 Subject: [PATCH] pybind/mgr/balancer: fix sanity check against minimal pg numbers per pool And rename some variables properly. Signed-off-by: xie xingguo --- src/pybind/mgr/balancer/module.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/pybind/mgr/balancer/module.py b/src/pybind/mgr/balancer/module.py index ed2bbfaa979..5e9da44cbf8 100644 --- a/src/pybind/mgr/balancer/module.py +++ b/src/pybind/mgr/balancer/module.py @@ -695,12 +695,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)) -- 2.39.5