From 4979df32c543fabacebf1b71cef19dc7082a9b63 Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Tue, 30 Apr 2013 16:35:11 -0700 Subject: [PATCH] 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 --- teuthology/misc.py | 14 ++++++++++++++ teuthology/task/ceph.py | 13 +------------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/teuthology/misc.py b/teuthology/misc.py index 86251b593a..8386ff44d1 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 07028aa974..5ff4c100f2 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...') -- 2.39.5