Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mgr/balancer: add cmd to list all plans #21937

Merged
merged 1 commit into from May 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/mgr/balancer.rst
Expand Up @@ -129,6 +129,10 @@ The name is provided by the user and can be any useful identifying string. The

ceph balancer show <plan-name>

All plans can be shown with::

ceph balancer ls

Old plans can be discarded with::

ceph balancer rm <plan-name>
Expand Down
7 changes: 7 additions & 0 deletions src/pybind/mgr/balancer/module.py
Expand Up @@ -271,6 +271,11 @@ class Module(MgrModule):
"desc": "Show an optimization plan",
"perm": "r",
},
{
"cmd": "balancer ls",
"desc": "List all plans",
"perm": "r",
},
{
"cmd": "balancer execute name=plan,type=CephString",
"desc": "Execute an optimization plan",
Expand Down Expand Up @@ -357,6 +362,8 @@ def handle_command(self, command):
elif command['prefix'] == 'balancer reset':
self.plans = {}
return (0, '', '')
elif command['prefix'] == 'balancer ls':
return (0, json.dumps([p for p in self.plans], indent=4), '')
elif command['prefix'] == 'balancer dump':
plan = self.plans.get(command['plan'])
if not plan:
Expand Down