]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr/balancer: define Plan.{dump,show}() 43965/head
authorKefu Chai <kchai@redhat.com>
Thu, 4 Feb 2021 13:15:27 +0000 (21:15 +0800)
committerCory Snyder <csnyder@iland.com>
Wed, 15 Dec 2021 20:18:56 +0000 (15:18 -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 in Octopus

src/pybind/mgr/balancer/module.py

index 36b6f3d34919e40a975026a068ad1fd0d2e40bd3..67eea04f41d8d0fd768a666097e961519d3755f0 100644 (file)
@@ -60,6 +60,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.
@@ -76,10 +83,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' %