From: Sage Weil Date: Thu, 14 Feb 2013 05:37:08 +0000 (-0800) Subject: ceph-disk-activate: catch daemon start errors X-Git-Tag: v0.56.5~5^2~69 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=656305f65eb33d68b95f4d29f37b031cf6cf889a;p=ceph.git ceph-disk-activate: catch daemon start errors Signed-off-by: Sage Weil (cherry picked from commit 690ae05309db118fb3fe390a48df33355fd068a0) --- diff --git a/src/ceph-disk-activate b/src/ceph-disk-activate index 71b5097cf365..f4755f794a38 100755 --- a/src/ceph-disk-activate +++ b/src/ceph-disk-activate @@ -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,