]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/balancer: add cmd to list all plans 21937/head
authorYang Honggang <yanghonggang@umcloud.com>
Fri, 11 May 2018 02:30:09 +0000 (02:30 +0000)
committerYang Honggang <yanghonggang@umcloud.com>
Sat, 12 May 2018 13:26:13 +0000 (13:26 +0000)
Signed-off-by: Yang Honggang <yanghonggang@umcloud.com>
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 fd54aae05f5aef9c337272fb6d1f4f6d55023dce..b6466ef53d94b452b899916993edb4e725b72861 100644 (file)
@@ -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",
@@ -357,6 +362,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: