From: Yang Honggang Date: Fri, 11 May 2018 02:30:09 +0000 (+0000) Subject: mgr/balancer: add cmd to list all plans X-Git-Tag: v13.2.5~144^2~13^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=00914f2c08bc9da78e0650e7060f313d6857bfef;p=ceph.git mgr/balancer: add cmd to list all plans Signed-off-by: Yang Honggang (cherry picked from commit 99245c69829c53dab6790da5502420c7183c6bcd) --- diff --git a/doc/mgr/balancer.rst b/doc/mgr/balancer.rst index fd8a8ced698c..52165e7cf2d3 100644 --- a/doc/mgr/balancer.rst +++ b/doc/mgr/balancer.rst @@ -129,6 +129,10 @@ The name is provided by the user and can be any useful identifying string. The ceph balancer show +All plans can be shown with:: + + ceph balancer ls + Old plans can be discarded with:: ceph balancer rm diff --git a/src/pybind/mgr/balancer/module.py b/src/pybind/mgr/balancer/module.py index 8f0ea5fc84a5..5841d63c90f0 100644 --- a/src/pybind/mgr/balancer/module.py +++ b/src/pybind/mgr/balancer/module.py @@ -272,6 +272,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", @@ -358,6 +363,8 @@ class Module(MgrModule): 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: