From 85efa8f99cd7c1253949fe3e4a93dcfca02fda91 Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Wed, 25 Sep 2019 13:09:39 +0800 Subject: [PATCH] mgr/balancer: enable pg_upmap cli for future use Signed-off-by: xie xingguo --- src/pybind/mgr/balancer/module.py | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/pybind/mgr/balancer/module.py b/src/pybind/mgr/balancer/module.py index 758aadd5721d0..83507b8054dd6 100644 --- a/src/pybind/mgr/balancer/module.py +++ b/src/pybind/mgr/balancer/module.py @@ -1250,11 +1250,23 @@ class Module(MgrModule): # upmap incdump = plan.inc.dump() - for pgid in incdump.get('old_pg_upmap_items', []): - self.log.info('ceph osd rm-pg-upmap-items %s', pgid) + for item in incdump.get('new_pg_upmap', []): + self.log.info('ceph osd pg-upmap %s mappings %s', item['pgid'], + item['osds']) result = CommandResult('foo') self.send_command(result, 'mon', '', json.dumps({ - 'prefix': 'osd rm-pg-upmap-items', + 'prefix': 'osd pg-upmap', + 'format': 'json', + 'pgid': item['pgid'], + 'id': item['osds'], + }), 'foo') + commands.append(result) + + for pgid in incdump.get('old_pg_upmap', []): + self.log.info('ceph osd rm-pg-upmap %s', pgid) + result = CommandResult('foo') + self.send_command(result, 'mon', '', json.dumps({ + 'prefix': 'osd rm-pg-upmap', 'format': 'json', 'pgid': pgid, }), 'foo') @@ -1275,6 +1287,16 @@ class Module(MgrModule): }), 'foo') commands.append(result) + for pgid in incdump.get('old_pg_upmap_items', []): + self.log.info('ceph osd rm-pg-upmap-items %s', pgid) + result = CommandResult('foo') + self.send_command(result, 'mon', '', json.dumps({ + 'prefix': 'osd rm-pg-upmap-items', + 'format': 'json', + 'pgid': pgid, + }), 'foo') + commands.append(result) + # wait for commands self.log.debug('commands %s' % commands) for result in commands: -- 2.39.5