]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/balancer: add cmd to list all plans 25293/head
authorYang Honggang <yanghonggang@umcloud.com>
Fri, 11 May 2018 02:30:09 +0000 (02:30 +0000)
committerNathan Cutler <ncutler@suse.com>
Tue, 27 Nov 2018 22:22:45 +0000 (23:22 +0100)
Signed-off-by: Yang Honggang <yanghonggang@umcloud.com>
(cherry picked from commit 99245c69829c53dab6790da5502420c7183c6bcd)

doc/mgr/balancer.rst
src/pybind/mgr/balancer/module.py

index fd8a8ced698c802ba1c7fe387a92c981f8d45c05..52165e7cf2d3db86b06c99fc8be48031dcc5700f 100644 (file)
@@ -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>
index 8f0ea5fc84a59d22c57e8bd668b60eb58e588f03..5841d63c90f0d512e9d8c7d945f87064b19716b5 100644 (file)
@@ -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: