]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
misc: move daemon stopping function to a generic place
authorJosh Durgin <josh.durgin@inktank.com>
Tue, 30 Apr 2013 23:35:11 +0000 (16:35 -0700)
committerJosh Durgin <josh.durgin@inktank.com>
Tue, 30 Apr 2013 23:35:11 +0000 (16:35 -0700)
This will be useful for other daemons, like radosgw, in the future.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
teuthology/misc.py
teuthology/task/ceph.py

index 86251b593aa98ff0599675483c82d2aeb871ea32..8386ff44d10ab1d3f915752e1a55eeeaae3e8148 100644 (file)
@@ -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]
index 07028aa974eb6a6fc89063fc030ddc69b5be1e3c..5ff4c100f2e440e2bec341593a4457e78e1f5e69 100644 (file)
@@ -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...')