Commit 5c22d16e authored by Iustin Pop's avatar Iustin Pop
Browse files

burnin: Add tests for add/remove disks and NICs

This patch adds testing of add/remove disks and NICs to the burnin.

Reviewed-by: imsnah
parent 19708787
......@@ -160,6 +160,12 @@ class Burner(object):
parser.add_option("--no-activate-disks", dest="do_activate_disks",
help="Skip disk activation/deactivation",
action="store_false", default=True)
parser.add_option("--no-add-disks", dest="do_addremove_disks",
help="Skip disk addition/removal",
action="store_false", default=True)
parser.add_option("--no-add-nics", dest="do_addremove_nics",
help="Skip NIC addition/removal",
action="store_false", default=True)
parser.add_option("--no-nics", dest="nics",
help="No network interfaces", action="store_const",
const=[], default=[{}])
......@@ -199,6 +205,7 @@ class Burner(object):
if options.disk_template == constants.DT_DISKLESS:
disk_size = disk_growth = []
opts.do_addremove_disks = False
else:
disk_size = [utils.ParseUnit(v) for v in options.disk_size.split(",")]
disk_growth = [utils.ParseUnit(v)
......@@ -503,6 +510,33 @@ class Burner(object):
self.ExecOp(op_deact)
self.StartInstance(instance)
def AddRemoveDisks(self):
"""Add and remove an extra disk for the instances."""
for instance in self.instances:
op_add = opcodes.OpSetInstanceParams(\
instance_name=instance,
disks=[(constants.DDM_ADD, {"size": self.disk_size[0]})])
op_rem = opcodes.OpSetInstanceParams(\
instance_name=instance, disks=[(constants.DDM_REMOVE, {})])
Log("- Adding a disk to instance %s" % (instance,))
self.ExecOp(op_add)
self.StopInstance(instance)
Log("- Removing the last disk of instance %s" % (instance,))
self.ExecOp(op_rem)
self.StartInstance(instance)
def AddRemoveNICs(self):
"""Add and remove an extra NIC for the instances."""
for instance in self.instances:
op_add = opcodes.OpSetInstanceParams(\
instance_name=instance, nics=[(constants.DDM_ADD, {})])
op_rem = opcodes.OpSetInstanceParams(\
instance_name=instance, nics=[(constants.DDM_REMOVE, {})])
Log("- Adding a NIC to instance %s" % (instance,))
self.ExecOp(op_add)
Log("- Removing the last NIC of instance %s" % (instance,))
self.ExecOp(op_rem)
def BurninCluster(self):
"""Test a cluster intensively.
......@@ -548,6 +582,12 @@ class Burner(object):
if opts.do_reboot:
self.Reboot()
if opts.do_addremove_disks:
self.AddRemoveDisks()
if opts.do_addremove_nics:
self.AddRemoveNICs()
if opts.do_activate_disks:
self.ActivateDisks()
......
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