]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
With coverage, use SIGTERM to make the daemons exit(0).
authorJosh Durgin <josh.durgin@dreamhost.com>
Fri, 10 Jun 2011 18:18:13 +0000 (11:18 -0700)
committerJosh Durgin <josh.durgin@dreamhost.com>
Fri, 10 Jun 2011 18:24:26 +0000 (11:24 -0700)
teuthology/task/ceph.py
teuthology/task/cfuse.py
teuthology/task/daemon-helper

index b09124666bd1403cf05ad82e31d2071fe9ec632c..1e731621f4971086420ad5be98cd52d582cfb35c 100644 (file)
@@ -54,9 +54,11 @@ def task(ctx, config):
         "task ceph only supports a dictionary for configuration"
 
     flavor = None
+    daemon_signal = 'kill'
     if config.get('coverage'):
         log.info('Recording coverage for this run.')
         flavor = 'gcov'
+        daemon_signal = 'term'
 
     log.info('Checking for old test directory...')
     processes = ctx.cluster.run(
@@ -283,6 +285,7 @@ def task(ctx, config):
                     '/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
                     coverage_dir,
                     '/tmp/cephtest/daemon-helper',
+                    daemon_signal,
                     '/tmp/cephtest/binary/usr/local/bin/cmon',
                     '-f',
                     '-i', id_,
@@ -439,6 +442,7 @@ def task(ctx, config):
                     '/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
                     coverage_dir,
                     '/tmp/cephtest/daemon-helper',
+                    daemon_signal,
                     '/tmp/cephtest/binary/usr/local/bin/cosd',
                     '-f',
                     '-i', id_,
@@ -459,6 +463,7 @@ def task(ctx, config):
                     '/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
                     coverage_dir,
                     '/tmp/cephtest/daemon-helper',
+                    daemon_signal,
                     '/tmp/cephtest/binary/usr/local/bin/cmds',
                     '-f',
                     '-i', id_,
@@ -479,30 +484,17 @@ def task(ctx, config):
     try:
         yield
     finally:
-        if config.get('coverage'):
-            # need to exit cleanly to trigger atexit coverage data writing
-            log.info('Shutting down everything, gcov style...')
-            mon0_remote.run(
-                args=[
-                    '/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
-                    coverage_dir,
-                    '/tmp/cephtest/binary/usr/local/bin/ceph',
-                    '-c', '/tmp/cephtest/ceph.conf',
-                    'all_exit'
-                    ]
-                )
-        else:
-            log.info('Shutting down mds daemons...')
-            for id_, proc in mds_daemons.iteritems():
-                proc.stdin.close()
-
-            log.info('Shutting down osd daemons...')
-            for id_, proc in osd_daemons.iteritems():
-                proc.stdin.close()
-
-            log.info('Shutting down mon daemons...')
-            for id_, proc in mon_daemons.iteritems():
-                proc.stdin.close()
+        log.info('Shutting down mds daemons...')
+        for id_, proc in mds_daemons.iteritems():
+            proc.stdin.close()
+
+        log.info('Shutting down osd daemons...')
+        for id_, proc in osd_daemons.iteritems():
+            proc.stdin.close()
+
+        log.info('Shutting down mon daemons...')
+        for id_, proc in mon_daemons.iteritems():
+            proc.stdin.close()
 
         run.wait(mds_daemons.itervalues())
         run.wait(osd_daemons.itervalues())
index e9fd52a247077e6e640ac32906a82fc611713d49..31553378b75d696d684103c63953de3fbd68b1ff 100644 (file)
@@ -45,6 +45,7 @@ def task(ctx, config):
                 '/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
                 '/tmp/cephtest/archive/coverage',
                 '/tmp/cephtest/daemon-helper',
+                'kill',
                 '/tmp/cephtest/binary/usr/local/bin/cfuse',
                 '-f',
                 '--name', 'client.{id}'.format(id=id_),
index a44fb4514cd00dd37db4b4780f8a980659ac6e14..4a044cbe798e40c568e57e7aaf58c4bcdc2015e1 100755 (executable)
@@ -21,9 +21,13 @@ import signal
 import subprocess
 import sys
 
+end_signal = signal.SIGKILL
+if sys.argv[1] == "term":
+    end_signal = signal.SIGTERM
+
 with file('/dev/null', 'rb') as devnull:
     proc = subprocess.Popen(
-        args=sys.argv[1:],
+        args=sys.argv[2:],
         stdin=devnull,
         )
 
@@ -37,7 +41,7 @@ while True:
         data = os.read(0, 1)
         if not data:
             saw_eof = True
-            proc.send_signal(signal.SIGKILL)
+            proc.send_signal(end_signal)
             break
 
     if proc.poll() is not None: