Skip to content

Commit 62c9f15

Browse files
author
Laura Flores
committed
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 <True|False> The feature is off by default. Signed-off-by: Laura Flores <[email protected]>
1 parent 31c498d commit 62c9f15

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/pybind/mgr/balancer/module.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,11 @@ class Module(MgrModule):
325325
type='str',
326326
default='',
327327
desc='pools which the automatic balancing will be limited to',
328+
runtime=True),
329+
Option(name='update_pg_upmap_activity',
330+
type='bool',
331+
default=False,
332+
desc='Updates pg_upmap activity stats to be used in `balancer status detail`',
328333
runtime=True)
329334
]
330335

@@ -369,6 +374,11 @@ def show_status_detail(self) -> Tuple[int, str, str]:
369374
"""
370375
Show balancer status (detailed)
371376
"""
377+
pg_upmap_activity = cast(bool, self.get_module_option('update_pg_upmap_activity'))
378+
if not pg_upmap_activity:
379+
msg = 'This command is disabled.\n' \
380+
'To enable, run `ceph config set mgr mgr/balancer/update_pg_upmap_activity True`.\n'
381+
return 0, msg, ''
372382
s = {
373383
'plans': list(self.plans.keys()),
374384
'active': self.active,
@@ -663,7 +673,9 @@ def plan_execute(self, plan: str) -> Tuple[int, str, str]:
663673
if not plan_:
664674
return (-errno.ENOENT, '', f'plan {plan} not found')
665675
r, detail = self.execute(plan_)
666-
self.update_pg_upmap_activity(plan_) # update pg activity in `balancer status detail`
676+
pg_upmap_activity = cast(bool, self.get_module_option('update_pg_upmap_activity'))
677+
if pg_upmap_activity:
678+
self.update_pg_upmap_activity(plan_) # update pg activity in `balancer status detail`
667679
self.plan_rm(plan)
668680
return (r, '', detail)
669681

@@ -755,7 +767,9 @@ def serve(self) -> None:
755767
self.execute(plan)
756768
else:
757769
self.optimize_result = detail
758-
self.update_pg_upmap_activity(plan) # update pg activity in `balancer status detail`
770+
pg_upmap_activity = cast(bool, self.get_module_option('update_pg_upmap_activity'))
771+
if pg_upmap_activity:
772+
self.update_pg_upmap_activity(plan) # update pg activity in `balancer status detail`
759773
self.optimizing = False
760774
self.log.debug('Sleeping for %d', sleep_interval)
761775
self.event.wait(sleep_interval)

0 commit comments

Comments
 (0)