From: Andrew Schoen Date: Wed, 29 Apr 2015 15:43:52 +0000 (-0400) Subject: Don't assert status==up when using internal.check_lock. X-Git-Tag: 1.1.0~953^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e6502c5f7f4cd003700fca2a0eb05e6976a287b9;p=teuthology.git Don't assert status==up when using internal.check_lock. Add a check_up kwarg to check_lock so that we can optionally skip checking to see if a node is up before nuking it. This still allows scheduled teuthology jobs to make sure they didn't lock a downed node. Signed-off-by: Andrew Schoen --- diff --git a/teuthology/nuke.py b/teuthology/nuke.py index 2b34e840..af02a608 100644 --- a/teuthology/nuke.py +++ b/teuthology/nuke.py @@ -497,7 +497,9 @@ def nuke_helper(ctx, should_unlock): log.info('console ready on %s' % cname) if ctx.check_locks: - check_lock(ctx, None) + # does not check to ensure if the node is 'up' + # we want to be able to nuke a downed node + check_lock(ctx, None, check_up=False) add_remotes(ctx, None) connect(ctx, None) diff --git a/teuthology/task/internal.py b/teuthology/task/internal.py index e850be49..ce49b2ff 100644 --- a/teuthology/task/internal.py +++ b/teuthology/task/internal.py @@ -184,7 +184,7 @@ def save_config(ctx, config): with file(os.path.join(ctx.archive, 'config.yaml'), 'w') as f: yaml.safe_dump(ctx.config, f, default_flow_style=False) -def check_lock(ctx, config): +def check_lock(ctx, config, check_up=True): """ Check lock status of remote machines. """ @@ -197,7 +197,10 @@ def check_lock(ctx, config): log.debug('machine status is %s', repr(status)) assert status is not None, \ 'could not read lock status for {name}'.format(name=machine) - assert status['up'], 'machine {name} is marked down'.format(name=machine) + if check_up: + assert status['up'], 'machine {name} is marked down'.format( + name=machine + ) assert status['locked'], \ 'machine {name} is not locked'.format(name=machine) assert status['locked_by'] == ctx.owner, \