From 46ea7adc0d195090a20cf8e2456d3e8ec208929e Mon Sep 17 00:00:00 2001 From: Laura Flores Date: Fri, 1 Nov 2024 22:44:17 +0000 Subject: [PATCH] mgr/balancer: tie `update_pg_upmap_activity` to a configurable This addition gives users the option of enabling/disabling this feature. They can do so by running: ceph config set mgr mgr/balancer/update_pg_upmap_activity The feature is off by default. Signed-off-by: Laura Flores (cherry picked from commit 62c9f152e31affe3e19eb50e917cbeb10624f8fd) --- src/pybind/mgr/balancer/module.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/balancer/module.py b/src/pybind/mgr/balancer/module.py index cb5a75f68d2..476304275c1 100644 --- a/src/pybind/mgr/balancer/module.py +++ b/src/pybind/mgr/balancer/module.py @@ -325,6 +325,11 @@ class Module(MgrModule): type='str', default='', desc='pools which the automatic balancing will be limited to', + runtime=True), + Option(name='update_pg_upmap_activity', + type='bool', + default=False, + desc='Updates pg_upmap activity stats to be used in `balancer status detail`', runtime=True) ] @@ -369,6 +374,11 @@ class Module(MgrModule): """ Show balancer status (detailed) """ + pg_upmap_activity = cast(bool, self.get_module_option('update_pg_upmap_activity')) + if not pg_upmap_activity: + msg = 'This command is disabled.\n' \ + 'To enable, run `ceph config set mgr mgr/balancer/update_pg_upmap_activity True`.\n' + return 0, msg, '' s = { 'plans': list(self.plans.keys()), 'active': self.active, @@ -663,7 +673,9 @@ class Module(MgrModule): if not plan_: return (-errno.ENOENT, '', f'plan {plan} not found') r, detail = self.execute(plan_) - self.update_pg_upmap_activity(plan_) # update pg activity in `balancer status detail` + pg_upmap_activity = cast(bool, self.get_module_option('update_pg_upmap_activity')) + if pg_upmap_activity: + self.update_pg_upmap_activity(plan_) # update pg activity in `balancer status detail` self.plan_rm(plan) return (r, '', detail) @@ -755,7 +767,9 @@ class Module(MgrModule): self.execute(plan) else: self.optimize_result = detail - self.update_pg_upmap_activity(plan) # update pg activity in `balancer status detail` + pg_upmap_activity = cast(bool, self.get_module_option('update_pg_upmap_activity')) + if pg_upmap_activity: + self.update_pg_upmap_activity(plan) # update pg activity in `balancer status detail` self.optimizing = False self.log.debug('Sleeping for %d', sleep_interval) self.event.wait(sleep_interval) -- 2.39.5