]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Move non-ceph logic out of the ceph task: host in use check.
authorTommi Virtanen <tommi.virtanen@dreamhost.com>
Thu, 16 Jun 2011 21:17:14 +0000 (14:17 -0700)
committerTommi Virtanen <tommi.virtanen@dreamhost.com>
Thu, 16 Jun 2011 21:36:21 +0000 (14:36 -0700)
To avoid every config always listing basic tasks, we silently
add internal.* tasks in front of the task list.

teuthology/run.py
teuthology/task/ceph.py
teuthology/task/internal.py [new file with mode: 0644]

index dbd24cce37ee5b68c1800feddbd31fca4c9fa879..a1414b27eb99c95e3cc498e38f818cfe02efff25 100644 (file)
@@ -92,6 +92,8 @@ def main():
 
     ctx.summary = {}
 
+    ctx.config['tasks'].insert(0, {'internal.check_conflict': None})
+
     from teuthology.run_tasks import run_tasks
     try:
         run_tasks(tasks=ctx.config['tasks'], ctx=ctx)
index d924b8fa0cf20987a5e26d3fd6642559c170b127..e5d06d2d03677c93bccf459bfb1fd6df27ee2e0c 100644 (file)
@@ -3,7 +3,6 @@ from cStringIO import StringIO
 import contextlib
 import logging
 import os
-import gevent
 import tarfile
 
 from teuthology import misc as teuthology
@@ -612,24 +611,6 @@ def task(ctx, config):
         log.info('Recording coverage for this run.')
         flavor = 'gcov'
 
-    log.info('Checking for old test directory...')
-    processes = ctx.cluster.run(
-        args=[
-            'test', '!', '-e', '/tmp/cephtest',
-            ],
-        wait=False,
-        )
-    failed = False
-    for proc in processes:
-        assert isinstance(proc.exitstatus, gevent.event.AsyncResult)
-        try:
-            proc.exitstatus.get()
-        except run.CommandFailedError:
-            log.error('Host %s has stale cephtest directory, check your lock and reboot to clean up.', proc.remote.shortname)
-            failed = True
-    if failed:
-        raise RuntimeError('Stale jobs detected, aborting.')
-
     coverage_dir = '/tmp/cephtest/archive/coverage'
     log.info('Creating directories...')
     run.wait(
diff --git a/teuthology/task/internal.py b/teuthology/task/internal.py
new file mode 100644 (file)
index 0000000..17b4e42
--- /dev/null
@@ -0,0 +1,25 @@
+import gevent
+import logging
+
+from orchestra import run
+
+log = logging.getLogger(__name__)
+
+def check_conflict(ctx, config):
+    log.info('Checking for old test directory...')
+    processes = ctx.cluster.run(
+        args=[
+            'test', '!', '-e', '/tmp/cephtest',
+            ],
+        wait=False,
+        )
+    failed = False
+    for proc in processes:
+        assert isinstance(proc.exitstatus, gevent.event.AsyncResult)
+        try:
+            proc.exitstatus.get()
+        except run.CommandFailedError:
+            log.error('Host %s has stale cephtest directory, check your lock and reboot to clean up.', proc.remote.shortname)
+            failed = True
+    if failed:
+        raise RuntimeError('Stale jobs detected, aborting.')