From 3097a154639465d7459bdfcb138ab128a6cf423b Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 4 Feb 2021 21:15:27 +0800 Subject: [PATCH] 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 in Octopus --- src/pybind/mgr/balancer/module.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/pybind/mgr/balancer/module.py b/src/pybind/mgr/balancer/module.py index 36b6f3d34919e..67eea04f41d8d 100644 --- a/src/pybind/mgr/balancer/module.py +++ b/src/pybind/mgr/balancer/module.py @@ -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' % -- 2.39.5