mirror of
https://github.com/ceph/ceph
synced 2025-02-21 09:57:26 +00:00
Add an option to keep machines locked if a test fails.
This commit is contained in:
parent
c47dc179e7
commit
28f19a4104
@ -60,6 +60,12 @@ def parse_args():
|
||||
default=False,
|
||||
help='block until locking machines succeeds (use with --lock)',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--keep-locked-on-error',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='unlock machines only if the test succeeds (use with --lock)',
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
return args
|
||||
@ -84,6 +90,9 @@ def main():
|
||||
if ctx.block:
|
||||
assert ctx.lock, \
|
||||
'the --block option is only supported with the --lock option'
|
||||
if ctx.keep_locked_on_error:
|
||||
assert ctx.lock, \
|
||||
'the --keep_locked_on_error option is only supported with the --lock option'
|
||||
|
||||
from teuthology.misc import read_config
|
||||
read_config(ctx)
|
||||
|
@ -70,9 +70,10 @@ def lock_machines(ctx, config):
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
log.info('Unlocking machines...')
|
||||
for machine in ctx.config['targets']:
|
||||
lock.unlock(ctx, machine, ctx.owner)
|
||||
if ctx.summary['success'] or not ctx.keep_locked_on_error:
|
||||
log.info('Unlocking machines...')
|
||||
for machine in ctx.config['targets']:
|
||||
lock.unlock(ctx, machine, ctx.owner)
|
||||
|
||||
def check_lock(ctx, config):
|
||||
log.info('Checking locks...')
|
||||
|
Loading…
Reference in New Issue
Block a user