From e6502c5f7f4cd003700fca2a0eb05e6976a287b9 Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Wed, 29 Apr 2015 11:43:52 -0400 Subject: [PATCH] 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 --- teuthology/nuke.py | 4 +++- teuthology/task/internal.py | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/teuthology/nuke.py b/teuthology/nuke.py index 2b34e8404..af02a6085 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 e850be499..ce49b2ff7 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, \ -- 2.47.3