]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr/balancer: define Plan.{dump,show}() 43964/head
authorKefu Chai <kchai@redhat.com>
Thu, 4 Feb 2021 13:15:27 +0000 (21:15 +0800)
committerCory Snyder <csnyder@iland.com>
Thu, 16 Dec 2021 09:35:13 +0000 (04:35 -0500)
as they are called by the commands

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 0d48b03)

Conflicts:
src/pybind/mgr/balancer/module.py

Cherry-pick notes:
- Conflicts due to missing type annotations on Pacific

src/pybind/mgr/balancer/module.py

index d1f9710c35507284be3022aae999beb262559afa..9f0ebb6819cbd16d8b3c414a36c358dbf1195de0 100644 (file)
@@ -59,6 +59,13 @@ class Plan(object):
         self.inc = osdmap.new_incremental()
         self.pg_status = {}
 
+    def dump(self) -> str:
+        return json.dumps(self.inc.dump(), indent=4, sort_keys=True)
+
+    def show(self) -> str:
+        return 'upmap plan'
+
+
 class MsPlan(Plan):
     """
     Plan with a preloaded MappingState member.
@@ -75,10 +82,7 @@ class MsPlan(Plan):
                             self.initial.raw_pool_stats,
                             'plan %s final' % self.name)
 
-    def dump(self):
-        return json.dumps(self.inc.dump(), indent=4, sort_keys=True)
-
-    def show(self):
+    def show(self) -> str:
         ls = []
         ls.append('# starting osdmap epoch %d' % self.initial.osdmap.get_epoch())
         ls.append('# starting crush version %d' %