From: Josh Durgin Date: Tue, 30 Apr 2013 23:35:11 +0000 (-0700) Subject: misc: move daemon stopping function to a generic place X-Git-Tag: 1.1.0~2167^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4979df32c543fabacebf1b71cef19dc7082a9b63;p=teuthology.git misc: move daemon stopping function to a generic place This will be useful for other daemons, like radosgw, in the future. Signed-off-by: Josh Durgin --- diff --git a/teuthology/misc.py b/teuthology/misc.py index 86251b593..8386ff44d 100644 --- a/teuthology/misc.py +++ b/teuthology/misc.py @@ -704,3 +704,17 @@ def get_valgrind_args(testdir, name, v): extra_args.extend(v) log.debug('running %s under valgrind with args %s', name, extra_args) return extra_args + +def stop_daemons_of_type(ctx, type_): + log.info('Shutting down %s daemons...' % type_) + exc_info = (None, None, None) + for daemon in ctx.daemons.iter_daemons_of_role(type_): + try: + daemon.stop() + except (run.CommandFailedError, + run.CommandCrashedError, + run.ConnectionLostError): + exc_info = sys.exc_info() + log.exception('Saw exception from %s.%s', daemon.role, daemon.id_) + if exc_info != (None, None, None): + raise exc_info[0], exc_info[1], exc_info[2] diff --git a/teuthology/task/ceph.py b/teuthology/task/ceph.py index 07028aa97..5ff4c100f 100644 --- a/teuthology/task/ceph.py +++ b/teuthology/task/ceph.py @@ -906,18 +906,7 @@ def run_daemon(ctx, config, type_): try: yield finally: - log.info('Shutting down %s daemons...' % type_) - exc_info = (None, None, None) - for daemon in ctx.daemons.iter_daemons_of_role(type_): - try: - daemon.stop() - except (run.CommandFailedError, - run.CommandCrashedError, - run.ConnectionLostError): - exc_info = sys.exc_info() - log.exception('Saw exception from %s.%s', daemon.role, daemon.id_) - if exc_info != (None, None, None): - raise exc_info[0], exc_info[1], exc_info[2] + teuthology.stop_daemons_of_type(ctx, type_) def healthy(ctx, config): log.info('Waiting until ceph is healthy...')