]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk-activate: catch daemon start errors
authorSage Weil <sage@inktank.com>
Thu, 14 Feb 2013 05:37:08 +0000 (21:37 -0800)
committerSage Weil <sage@inktank.com>
Fri, 26 Apr 2013 20:40:01 +0000 (13:40 -0700)
Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 690ae05309db118fb3fe390a48df33355fd068a0)

src/ceph-disk-activate

index 71b5097cf3658c44ae10b8f68f45e003faab7bf3..f4755f794a384d03bad8ca3398714d4f268c9902 100755 (executable)
@@ -296,37 +296,40 @@ def start_daemon(
         cluster=cluster, osd_id=osd_id)
 
     # upstart?
-    if os.path.exists(os.path.join(path,'upstart')):
-        subprocess.check_call(
-            args=[
-                '/sbin/initctl',
-                # use emit, not start, because start would fail if the
-                # instance was already running
-                'emit',
-                # since the daemon starting doesn't guarantee much about
-                # the service being operational anyway, don't bother
-                # waiting for it
-                '--no-wait',
-                '--',
-                'ceph-osd',
-                'cluster={cluster}'.format(cluster=cluster),
-                'id={osd_id}'.format(osd_id=osd_id),
-                ],
-            )
-    elif os.path.exists(os.path.join(path, 'sysvinit')):
-        subprocess.check_call(
-            args=[
-                '/usr/sbin/service',
-                'ceph',
-                'start',
-                'osd.{osd_id}'.format(osd_id=osd_id),
-                ],
-            )
-    else:
-        raise ActivateError('{cluster} osd.{osd_id} is not tagged with an init system'.format(
-                cluster=cluster,
-                osd_id=osd_id,
-                ))
+    try:
+        if os.path.exists(os.path.join(path,'upstart')):
+            subprocess.check_call(
+                args=[
+                    '/sbin/initctl',
+                    # use emit, not start, because start would fail if the
+                    # instance was already running
+                    'emit',
+                    # since the daemon starting doesn't guarantee much about
+                    # the service being operational anyway, don't bother
+                    # waiting for it
+                    '--no-wait',
+                    '--',
+                    'ceph-osd',
+                    'cluster={cluster}'.format(cluster=cluster),
+                    'id={osd_id}'.format(osd_id=osd_id),
+                    ],
+                )
+        elif os.path.exists(os.path.join(path, 'sysvinit')):
+            subprocess.check_call(
+                args=[
+                    '/usr/sbin/service',
+                    'ceph',
+                    'start',
+                    'osd.{osd_id}'.format(osd_id=osd_id),
+                    ],
+                )
+        else:
+            raise ActivateError('{cluster} osd.{osd_id} is not tagged with an init system'.format(
+                    cluster=cluster,
+                    osd_id=osd_id,
+                    ))
+    except subprocess.CalledProcessError as e:
+        raise ActivateError('ceph osd start failed', e)
 
 def detect_fstype(
     dev,