From 4e68c2033cb97a53b339dc588a81706645ae4621 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sat, 23 Mar 2013 20:58:46 -0700 Subject: [PATCH] verify /var/lib/ceph not present on start 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 --- teuthology/run.py | 1 + teuthology/task/internal.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/teuthology/run.py b/teuthology/run.py index f9027cb095b41..f15bb99205511 100644 --- a/teuthology/run.py +++ b/teuthology/run.py @@ -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']}) diff --git a/teuthology/task/internal.py b/teuthology/task/internal.py index fe3ef354945a8..1adb05992af52 100644 --- a/teuthology/task/internal.py +++ b/teuthology/task/internal.py @@ -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) -- 2.39.5