]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
nuke: allow not rebooting again
authorJosh Durgin <jdurgin@redhat.com>
Tue, 9 Feb 2021 19:24:02 +0000 (19:24 +0000)
committerJosh Durgin <jdurgin@redhat.com>
Tue, 9 Feb 2021 19:24:07 +0000 (19:24 +0000)
The default behavior was changed to always reboot in
1d47a121b385e2656e9314e9d63faf68a8e865e4 but the --reboot-all option
remained. Keep the original option around for compatibility with
existing scripts.

Signed-off-by: Josh Durgin <jdurgin@redhat.com>
scripts/nuke.py
teuthology/nuke/__init__.py

index 078d743f07898b407299d90738b3f73a461a566b..0b1644c3e720219fc41ad81541532c52236cf1d3 100644 (file)
@@ -5,7 +5,7 @@ import teuthology.nuke
 doc = """
 usage:
   teuthology-nuke --help
-  teuthology-nuke [-v] [--owner OWNER] [-n NAME] [-u] [-i] [-r] [-s] [-k]
+  teuthology-nuke [-v] [--owner OWNER] [-n NAME] [-u] [-i] [-r|-R] [-s] [-k]
                        [-p PID] [--dry-run] (-t CONFIG... | -a DIR)
   teuthology-nuke [-v] [-u] [-i] [-r] [-s] [--dry-run] --owner OWNER --stale
   teuthology-nuke [-v] [--dry-run] --stale-openstack
@@ -27,7 +27,8 @@ optional arguments:
                         targets that would be nuked
   --owner OWNER         job owner
   -p PID, --pid PID     pid of the process to be killed
-  -r, --reboot-all      reboot all machines
+  -r, --reboot-all      reboot all machines (default)
+  -R, --no-reboot       do not reboot the machines
   -s, --synch-clocks    synchronize clocks on all machines
   -u, --unlock          Unlock each successfully nuked machine, and output
                         targets thatcould not be nuked.
index 785c211ab6a0eb4d4b7a8602b9796796d06d56d6..91b9f35dc4423338861bf0de65a18989030d7fae 100644 (file)
@@ -232,10 +232,10 @@ def main(args):
         else:
             subprocess.check_call(["kill", "-9", str(ctx.pid)])
 
-    nuke(ctx, ctx.unlock, ctx.synch_clocks, ctx.reboot_all, ctx.noipmi)
+    nuke(ctx, ctx.unlock, ctx.synch_clocks, ctx.noipmi)
 
 
-def nuke(ctx, should_unlock, sync_clocks=True, reboot_all=True, noipmi=False):
+def nuke(ctx, should_unlock, sync_clocks=True, noipmi=False):
     if 'targets' not in ctx.config:
         return
     total_unnuked = {}
@@ -260,7 +260,6 @@ def nuke(ctx, should_unlock, sync_clocks=True, reboot_all=True, noipmi=False):
                 {target: hostkey},
                 should_unlock,
                 sync_clocks,
-                reboot_all,
                 ctx.config.get('check-locks', True),
                 noipmi,
             )
@@ -275,22 +274,22 @@ def nuke(ctx, should_unlock, sync_clocks=True, reboot_all=True, noipmi=False):
                                   default_flow_style=False).splitlines()))
 
 
-def nuke_one(ctx, target, should_unlock, synch_clocks, reboot_all,
+def nuke_one(ctx, target, should_unlock, synch_clocks,
              check_locks, noipmi):
     ret = None
     keep_logs = ctx.keep_logs
+    should_reboot = not ctx.no_reboot
     ctx = argparse.Namespace(
         config=dict(targets=target),
         owner=ctx.owner,
         check_locks=check_locks,
         synch_clocks=synch_clocks,
-        reboot_all=reboot_all,
         teuthology_config=config.to_dict(),
         name=ctx.name,
         noipmi=noipmi,
     )
     try:
-        nuke_helper(ctx, should_unlock, keep_logs)
+        nuke_helper(ctx, should_unlock, keep_logs, should_reboot)
     except Exception:
         log.exception('Could not nuke %s' % target)
         # not re-raising the so that parallel calls aren't killed
@@ -301,7 +300,7 @@ def nuke_one(ctx, target, should_unlock, synch_clocks, reboot_all,
     return ret
 
 
-def nuke_helper(ctx, should_unlock, keep_logs):
+def nuke_helper(ctx, should_unlock, keep_logs, should_reboot):
     # ensure node is up with ipmi
     (target,) = ctx.config['targets'].keys()
     host = target.split('@')[-1]
@@ -340,7 +339,8 @@ def nuke_helper(ctx, should_unlock, keep_logs):
     # Try to remove packages before reboot
     remove_installed_packages(ctx)
     remotes = ctx.cluster.remotes.keys()
-    reboot(ctx, remotes)
+    if should_reboot:
+        reboot(ctx, remotes)
     # shutdown daemons again incase of startup
     shutdown_daemons(ctx)
     remove_osd_mounts(ctx)