summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlmr <lmr@592f7852-d20e-0410-864c-8624ca9c26a4>2011-02-21 12:33:56 +0000
committerlmr <lmr@592f7852-d20e-0410-864c-8624ca9c26a4>2011-02-21 12:33:56 +0000
commit6606ba16a5342994d92e48df14fd504b9669e7da (patch)
treed582d2ffda3abc3250f24972dfdd638e7c1b32fa
parente27763e14c41e1ca4a4f3628752eb00838ca1986 (diff)
KVM test: nic_hotplug: Add romfile support
This patch allows to test hotplug a nic with dedicated rom file. Signed-off-by: Jason Wang <jasowang@redhat.com> git-svn-id: svn://test.kernel.org/autotest/trunk@5237 592f7852-d20e-0410-864c-8624ca9c26a4
-rw-r--r--client/tests/kvm/tests/nic_hotplug.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/client/tests/kvm/tests/nic_hotplug.py b/client/tests/kvm/tests/nic_hotplug.py
index 50a3ce9e..2946396e 100644
--- a/client/tests/kvm/tests/nic_hotplug.py
+++ b/client/tests/kvm/tests/nic_hotplug.py
@@ -25,6 +25,7 @@ def run_nic_hotplug(test, params, env):
guest_delay = int(params.get("guest_delay", 20))
session_serial = kvm_test_utils.wait_for_login(vm, timeout=timeout,
serial=True)
+ romfile = params.get("romfile")
# Modprobe the module if specified in config file
module = params.get("modprobe_module")
@@ -57,7 +58,7 @@ def run_nic_hotplug(test, params, env):
logging.error(network)
raise error.TestError("Fail to remove netdev %s" % n_id)
- def nic_add(vm, model, netdev_id, mac):
+ def nic_add(vm, model, netdev_id, mac, rom=None):
"""
Add a nic to virtual machine
@@ -65,6 +66,7 @@ def run_nic_hotplug(test, params, env):
@model: nic model
@netdev_id: id of netdev
@mac: Mac address of new nic
+ @rom: Rom file
"""
nic_id = kvm_utils.generate_random_id()
if model == "virtio":
@@ -72,6 +74,8 @@ def run_nic_hotplug(test, params, env):
device_add_cmd = "device_add %s,netdev=%s,mac=%s,id=%s" % (model,
netdev_id,
mac, nic_id)
+ if rom:
+ device_add_cmd += ",romfile=%s" % rom
logging.info("Adding nic through %s", device_add_cmd)
vm.monitor.cmd(device_add_cmd)
@@ -108,7 +112,7 @@ def run_nic_hotplug(test, params, env):
if not mac:
mac = "00:00:02:00:00:02"
netdev_id = netdev_add(vm)
- device_id = nic_add(vm, "virtio", netdev_id, mac)
+ device_id = nic_add(vm, "virtio", netdev_id, mac, romfile)
if "Win" not in params.get("guest_name", ""):
session_serial.sendline("dhclient %s &" %