From: Timothy Q Nguyen Date: Thu, 23 Oct 2025 17:32:01 +0000 (-0700) Subject: mgr/balancer: optimized info level logs X-Git-Tag: v21.0.0~577^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=40ceb20b267a83b51b6080d7600382ae139c9584;p=ceph.git mgr/balancer: optimized info level logs Improved the quality of one of the info level logs by adding more information to it and removing a similar log in debug level. This is in an effort to provide maximum information at info level without clogging up the info level logs with multiple logs. I've also added a check for the "balancing root" logs which are repeated multiple times without adding new information. Now only the first of the repeating "balancing root" logs is logged at info level, the rest will be logged in debug level. Signed-off-by: Timothy Q Nguyen --- diff --git a/src/pybind/mgr/balancer/module.py b/src/pybind/mgr/balancer/module.py index ee18869cc531..3f73682894dc 100644 --- a/src/pybind/mgr/balancer/module.py +++ b/src/pybind/mgr/balancer/module.py @@ -1020,10 +1020,9 @@ class Module(MgrModule): return pe.show(verbose=verbose) def optimize(self, plan: Plan) -> Tuple[int, str]: - self.log.debug('Optimize plan %s' % plan.name) max_misplaced = cast(float, self.get_ceph_option('target_max_misplaced_ratio')) - self.log.info('Mode %s, max misplaced %f' % - (plan.mode, max_misplaced)) + self.log.info('Optimize plan %s, mode %s, max misplaced %f' % + (plan.name, plan.mode, max_misplaced)) info = self.get('pg_status') unknown = info.get('unknown_pgs_ratio', 0.0) @@ -1301,13 +1300,17 @@ class Module(MgrModule): min_pgs = osds * min_pg_per_osd if best_pe.total_by_root[root][key] < min_pgs: self.log.debug('Skipping root %s (pools %s), total pgs %d ' - '< minimum %d (%d per osd)', - root, pools, - best_pe.total_by_root[root][key], - min_pgs, min_pg_per_osd) + '< minimum %d (%d 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)) + if left == max_iterations: + self.log.info('Balancing root %s (pools %s) by %s' % + (root, pools, key)) + else: + self.log.debug('Balancing root %s (pools %s) by %s' % + (root, pools, key)) target = best_pe.target_by_root[root] actual = best_pe.actual_by_root[root][key] queue = sorted(actual.keys(),