]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
Add teuthology-nuke --stale
authorZack Cerza <zack@redhat.com>
Wed, 10 Dec 2014 20:18:04 +0000 (13:18 -0700)
committerZack Cerza <zack@redhat.com>
Fri, 12 Dec 2014 18:34:22 +0000 (11:34 -0700)
Signed-off-by: Zack Cerza <zack@redhat.com>
scripts/nuke.py
teuthology/nuke.py

index 0c2d4550675fbdee6ba39a744943e7132a12884f..601247d7adff0748a7fa8f0604391c042d8ed1c3 100644 (file)
@@ -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
index 9d8284ce387450065613c11cbd0985aa8e06f2e6..e2a18250628324a39496e1eddbf9a930742b5f16 100644 (file)
@@ -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(