]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
verify /var/lib/ceph not present on start
authorSage Weil <sage@inktank.com>
Sun, 24 Mar 2013 03:58:46 +0000 (20:58 -0700)
committerSage Weil <sage@inktank.com>
Sun, 24 Mar 2013 03:58:46 +0000 (20:58 -0700)
Verify there is no /var/lib/ceph, just like we do with the cephtest
directory.  We will need to change this (or make it optional) when we
allow runs against an existing cluster, but then a whole bunch of other
things will need to change then as well.

Signed-off-by: Sage Weil <sage@inktank.com>
teuthology/run.py
teuthology/task/internal.py

index f9027cb095b41db932ba8a94741b361ff0d06446..f15bb99205511b6568df7dac7d345954a353acaf 100644 (file)
@@ -161,6 +161,7 @@ def main():
             {'internal.check_lock': None},
             {'internal.connect': None},
             {'internal.check_conflict': None},
+            {'internal.check_ceph_data': None},
             ])
     if 'kernel' in ctx.config:
         init_tasks.append({'kernel': ctx.config['kernel']})
index fe3ef354945a88760c61403f08d0ef76273af8cb..1adb05992af5275b3252d162c09bf6094c03a152 100644 (file)
@@ -170,6 +170,25 @@ def connect(ctx, config):
         for rem in remotes:
             ctx.cluster.add(rem, rem.name)
 
+def check_ceph_data(ctx, config):
+    log.info('Checking for old /var/lib/ceph...')
+    processes = ctx.cluster.run(
+        args=[
+            'test', '!', '-e', '/var/lib/ceph',
+            ],
+        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 /var/lib/ceph, check lock and nuke/cleanup.', proc.remote.shortname)
+            failed = True
+    if failed:
+        raise RuntimeError('Stale /var/lib/ceph detected, aborting.')
+
 def check_conflict(ctx, config):
     log.info('Checking for old test directory...')
     test_basedir = teuthology.get_testdir_base(ctx)