From a0de02bb2220d1ff9090309aada9e51d70d97f4e Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Wed, 10 Dec 2014 13:18:04 -0700 Subject: [PATCH] Add teuthology-nuke --stale Signed-off-by: Zack Cerza --- scripts/nuke.py | 2 ++ teuthology/nuke.py | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/scripts/nuke.py b/scripts/nuke.py index 0c2d455067..601247d7ad 100644 --- a/scripts/nuke.py +++ b/scripts/nuke.py @@ -17,6 +17,8 @@ optional arguments: yaml config containing machines to nuke -a DIR, --archive DIR archive path for a job to kill and nuke + --stale attempt to find and nuke 'stale' machines + (e.g. locked by jobs that are no longer running) --owner OWNER job owner -p PID, --pid PID pid of the process to be killed -r, --reboot-all reboot all machines diff --git a/teuthology/nuke.py b/teuthology/nuke.py index 9d8284ce38..e2a1825062 100644 --- a/teuthology/nuke.py +++ b/teuthology/nuke.py @@ -13,6 +13,7 @@ from .orchestra import run from .config import FakeNamespace from .lock import list_locks from .lock import unlock_one +from .lock import find_stale_locks from .misc import config_file from .misc import merge_configs from .misc import get_testdir @@ -362,6 +363,13 @@ def main(args): if ctx.targets: ctx.config = merge_configs(ctx.targets) + if ctx.stale: + stale_nodes = find_stale_locks(ctx.owner) + targets = dict() + for node in stale_nodes: + targets[node['name']] = node['ssh_pub_key'] + ctx.config = dict(targets=targets) + read_config(ctx) log.info( -- 2.39.5