Commit 00f91f29 authored by Iustin Pop's avatar Iustin Pop
Browse files

burnin: add instance reinstall and reboot

These two operations were missing from burnin. The reboot is done with
all valid modes (a new constant is added), and the reinstall is done
both with and without specifying the OS (to account for the two code
paths in the LU).

Reviewed-by: imsnah
parent a5e7be6b
...@@ -264,6 +264,10 @@ INSTANCE_REBOOT_SOFT = "soft" ...@@ -264,6 +264,10 @@ INSTANCE_REBOOT_SOFT = "soft"
INSTANCE_REBOOT_HARD = "hard" INSTANCE_REBOOT_HARD = "hard"
INSTANCE_REBOOT_FULL = "full" INSTANCE_REBOOT_FULL = "full"
REBOOT_TYPES = frozenset([INSTANCE_REBOOT_SOFT,
INSTANCE_REBOOT_HARD,
INSTANCE_REBOOT_FULL])
# HV parameter names (global namespace) # HV parameter names (global namespace)
HV_BOOT_ORDER = "boot_order" HV_BOOT_ORDER = "boot_order"
HV_CDROM_IMAGE_PATH = "cdrom_image_path" HV_CDROM_IMAGE_PATH = "cdrom_image_path"
......
...@@ -151,6 +151,12 @@ class Burner(object): ...@@ -151,6 +151,12 @@ class Burner(object):
parser.add_option("--no-startstop", dest="do_startstop", parser.add_option("--no-startstop", dest="do_startstop",
help="Skip instance stop/start", action="store_false", help="Skip instance stop/start", action="store_false",
default=True) default=True)
parser.add_option("--no-reinstall", dest="do_reinstall",
help="Skip instance reinstall", action="store_false",
default=True)
parser.add_option("--no-reboot", dest="do_reboot",
help="Skip instance reboot", action="store_false",
default=True)
parser.add_option("--no-nics", dest="nics", parser.add_option("--no-nics", dest="nics",
help="No network interfaces", action="store_const", help="No network interfaces", action="store_const",
const=[], default=[{}]) const=[], default=[{}])
...@@ -359,7 +365,8 @@ class Burner(object): ...@@ -359,7 +365,8 @@ class Burner(object):
if self.opts.iallocator: if self.opts.iallocator:
pnode = snode = None pnode = snode = None
import_log_msg = ("- Import instance %s from node %s (iallocator: %s)" % import_log_msg = ("- Import instance %s from node %s"
" (iallocator: %s)" %
(instance, enode, self.opts.iallocator)) (instance, enode, self.opts.iallocator))
elif self.opts.disk_template not in constants.DTS_NET_MIRROR: elif self.opts.disk_template not in constants.DTS_NET_MIRROR:
snode = None snode = None
...@@ -457,6 +464,29 @@ class Burner(object): ...@@ -457,6 +464,29 @@ class Burner(object):
self.RenameInstance(rename, instance) self.RenameInstance(rename, instance)
self.StartInstance(instance) self.StartInstance(instance)
def Reinstall(self):
"""Reinstall the instances."""
for instance in self.instances:
self.StopInstance(instance)
op = opcodes.OpReinstallInstance(instance_name=instance)
Log("- Reinstall instance %s without passing the OS" % (instance,))
self.ExecOp(op)
op = opcodes.OpReinstallInstance(instance_name=instance,
os_type=self.opts.os)
Log("- Reinstall instance %s specifying the OS" % (instance,))
self.ExecOp(op)
self.StartInstance(instance)
def Reboot(self):
"""Reinstall the instances."""
for instance in self.instances:
for reboot_type in constants.REBOOT_TYPES:
op = opcodes.OpRebootInstance(instance_name=instance,
reboot_type=reboot_type,
ignore_secondaries=False)
Log("- Reboot instance %s with type '%s'" % (instance, reboot_type))
self.ExecOp(op)
def BurninCluster(self): def BurninCluster(self):
"""Test a cluster intensively. """Test a cluster intensively.
...@@ -496,6 +526,12 @@ class Burner(object): ...@@ -496,6 +526,12 @@ class Burner(object):
constants.DT_FILE)): constants.DT_FILE)):
self.ImportExport() self.ImportExport()
if opts.do_reinstall:
self.Reinstall()
if opts.do_reboot:
self.Reboot()
if opts.do_startstop: if opts.do_startstop:
self.StopStart() self.StopStart()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment