From: Kefu Chai Date: Thu, 4 Feb 2021 13:15:27 +0000 (+0800) Subject: pybind/mgr/balancer: define Plan.{dump,show}() X-Git-Tag: v16.2.8~291^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F43964%2Fhead;p=ceph.git pybind/mgr/balancer: define Plan.{dump,show}() as they are called by the commands Signed-off-by: Kefu Chai (cherry picked from commit 0d48b03) Conflicts: src/pybind/mgr/balancer/module.py Cherry-pick notes: - Conflicts due to missing type annotations on Pacific --- diff --git a/src/pybind/mgr/balancer/module.py b/src/pybind/mgr/balancer/module.py index d1f9710c3550..9f0ebb6819cb 100644 --- a/src/pybind/mgr/balancer/module.py +++ b/src/pybind/mgr/balancer/module.py @@ -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' %