]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr/balancer: be more specific on execute() error
authorxie xingguo <xie.xingguo@zte.com.cn>
Thu, 1 Feb 2018 02:39:51 +0000 (10:39 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Mon, 5 Feb 2018 03:18:54 +0000 (11:18 +0800)
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 <xie.xingguo@zte.com.cn>
src/pybind/mgr/balancer/module.py

index 58d2052ed6192b401edde263b7c94d8c8afa4828..9511cfaef5c0fa93d25b60aa9fd1092782414a55 100644 (file)
@@ -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, ''