]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk: improve trigger verbosity
authorLoic Dachary <ldachary@redhat.com>
Mon, 29 Feb 2016 11:18:41 +0000 (18:18 +0700)
committerLoic Dachary <ldachary@redhat.com>
Fri, 4 Mar 2016 02:13:35 +0000 (09:13 +0700)
The ceph-disk activate errors were ignored and not displayed. Capture
stdout/stderr and display it if the exit code is non zero. Also fail
when an activate fails.

Pass the --verbose flag to activate, if given to trigger.

Signed-off-by: Loic Dachary <loic@dachary.org>
src/ceph-disk/ceph_disk/main.py

index 79b1041d99f6c44647e8f5af9f56fe2b66510ec5..17d3d6ddfc6c3302d676e9009966d5c2907a3087 100755 (executable)
@@ -4258,11 +4258,15 @@ def main_trigger(args):
         partid=partid,
     ))
 
+    ceph_disk = ['ceph-disk']
+    if args.verbose:
+        ceph_disk.append('--verbose')
+
     if parttype in (PTYPE['regular']['osd']['ready'],
                     PTYPE['mpath']['osd']['ready']):
-        command(
+        out, err, ret = command(
+            ceph_disk +
             [
-                'ceph-disk',
                 'activate',
                 args.dev,
             ]
@@ -4270,9 +4274,9 @@ def main_trigger(args):
 
     elif parttype in (PTYPE['plain']['osd']['ready'],
                       PTYPE['luks']['osd']['ready']):
-        command(
+        out, err, ret = command(
+            ceph_disk +
             [
-                '/usr/sbin/ceph-disk',
                 'activate',
                 '--dmcrypt',
                 args.dev,
@@ -4281,9 +4285,9 @@ def main_trigger(args):
 
     elif parttype in (PTYPE['regular']['journal']['ready'],
                       PTYPE['mpath']['journal']['ready']):
-        command(
+        out, err, ret = command(
+            ceph_disk +
             [
-                'ceph-disk',
                 'activate-journal',
                 args.dev,
             ]
@@ -4291,9 +4295,9 @@ def main_trigger(args):
 
     elif parttype in (PTYPE['plain']['journal']['ready'],
                       PTYPE['luks']['journal']['ready']):
-        command(
+        out, err, ret = command(
+            ceph_disk +
             [
-                '/usr/sbin/ceph-disk',
                 'activate-journal',
                 '--dmcrypt',
                 args.dev,
@@ -4302,9 +4306,9 @@ def main_trigger(args):
 
     elif parttype in (PTYPE['regular']['block']['ready'],
                       PTYPE['mpath']['block']['ready']):
-        command(
+        out, err, ret = command(
+            ceph_disk +
             [
-                'ceph-disk',
                 'activate-block',
                 args.dev,
             ]
@@ -4312,9 +4316,9 @@ def main_trigger(args):
 
     elif parttype in (PTYPE['plain']['block']['ready'],
                       PTYPE['luks']['block']['ready']):
-        command(
+        out, err, ret = command(
+            ceph_disk +
             [
-                '/usr/sbin/ceph-disk',
                 'activate-block',
                 '--dmcrypt',
                 args.dev,
@@ -4323,9 +4327,9 @@ def main_trigger(args):
 
     elif parttype in (PTYPE['regular']['lockbox']['ready'],
                       PTYPE['mpath']['lockbox']['ready']):
-        command(
+        out, err, ret = command(
+            ceph_disk +
             [
-                'ceph-disk',
                 'activate-lockbox',
                 args.dev,
             ]
@@ -4334,6 +4338,14 @@ def main_trigger(args):
     else:
         raise Error('unrecognized partition type %s' % parttype)
 
+    if ret != 0:
+        LOG.info(out)
+        LOG.error(err)
+        raise Error('return code ' + str(ret))
+    else:
+        LOG.debug(out)
+        LOG.debug(err)
+
 
 def setup_statedir(dir):
     # XXX The following use of globals makes linting