From bd689991d53f2c6eee7405ac48e533b9d064c3a1 Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Thu, 1 Feb 2018 10:39:51 +0800 Subject: [PATCH] pybind/mgr/balancer: be more specific on execute() error i.e.: Was: ~# ceph balancer execute upmap Now: ~# ceph balancer execute upmap Error EPERM: min_compat_client jewel < luminous, which is required for pg-upmap. Try 'ceph osd set-require-min-compat-client luminous' before using the new interface Signed-off-by: xie xingguo (cherry picked from commit 585ba6f9418c714a4a602b4b2d03d82b7c26e123) --- src/pybind/mgr/balancer/module.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/pybind/mgr/balancer/module.py b/src/pybind/mgr/balancer/module.py index 8bf3d57a7dd7f..419eabb761db4 100644 --- a/src/pybind/mgr/balancer/module.py +++ b/src/pybind/mgr/balancer/module.py @@ -342,9 +342,9 @@ class Module(MgrModule): plan = self.plans.get(command['plan']) if not plan: return (-errno.ENOENT, '', 'plan %s not found' % command['plan']) - self.execute(plan) + r, detail = self.execute(plan) self.plan_rm(command['plan']) - return (0, '', '') + return (r, '', detail) else: return (-errno.EINVAL, '', "Command not found '{0}'".format(command['prefix'])) @@ -914,7 +914,7 @@ class Module(MgrModule): r, outb, outs = result.wait() if r != 0: self.log.error('Error creating compat weight-set') - return + return r, outs for osd, weight in plan.compat_ws.iteritems(): self.log.info('ceph osd crush weight-set reweight-compat osd.%d %f', @@ -974,6 +974,7 @@ class Module(MgrModule): for result in commands: r, outb, outs = result.wait() if r != 0: - self.log.error('Error on command') - return + self.log.error('execute error: r = %d, detail = %s' % (r, outs)) + return r, outs self.log.debug('done') + return 0, '' -- 2.39.5