Index: client/tests/kvm/tests/nic_hotplug.py |
diff --git a/client/tests/kvm/tests/nic_hotplug.py b/client/tests/kvm/tests/nic_hotplug.py |
index d44276a522306f5b5dfda0f26614834c8f8af5ba..059277e21dc2c5c654d24729ac585ed1cf9249c1 100644 |
--- a/client/tests/kvm/tests/nic_hotplug.py |
+++ b/client/tests/kvm/tests/nic_hotplug.py |
@@ -1,6 +1,6 @@ |
import logging |
from autotest_lib.client.common_lib import error |
-import kvm_test_utils, kvm_utils |
+from autotest_lib.client.virt import virt_test_utils, virt_utils |
def run_nic_hotplug(test, params, env): |
@@ -20,10 +20,10 @@ def run_nic_hotplug(test, params, env): |
@param params: Dictionary with the test parameters. |
@param env: Dictionary with test environment. |
""" |
- vm = kvm_test_utils.get_living_vm(env, params.get("main_vm")) |
+ vm = virt_test_utils.get_living_vm(env, params.get("main_vm")) |
timeout = int(params.get("login_timeout", 360)) |
guest_delay = int(params.get("guest_delay", 20)) |
- session = kvm_test_utils.wait_for_login(vm, timeout=timeout) |
+ session = virt_test_utils.wait_for_login(vm, timeout=timeout) |
romfile = params.get("romfile") |
# Modprobe the module if specified in config file |
@@ -32,11 +32,11 @@ def run_nic_hotplug(test, params, env): |
session.get_command_output("modprobe %s" % module) |
def netdev_add(vm): |
- netdev_id = kvm_utils.generate_random_id() |
+ netdev_id = virt_utils.generate_random_id() |
attach_cmd = ("netdev_add tap,id=%s" % netdev_id) |
nic_script = params.get("nic_script") |
if nic_script: |
- attach_cmd += ",script=%s" % kvm_utils.get_path(vm.root_dir, |
+ attach_cmd += ",script=%s" % virt_utils.get_path(vm.root_dir, |
nic_script) |
netdev_extra_params = params.get("netdev_extra_params") |
if netdev_extra_params: |
@@ -69,7 +69,7 @@ def run_nic_hotplug(test, params, env): |
@mac: Mac address of new nic |
@rom: Rom file |
""" |
- nic_id = kvm_utils.generate_random_id() |
+ nic_id = virt_utils.generate_random_id() |
if model == "virtio": |
model = "virtio-net-pci" |
device_add_cmd = "device_add %s,netdev=%s,mac=%s,id=%s" % (model, |
@@ -100,7 +100,7 @@ def run_nic_hotplug(test, params, env): |
vm.monitor.cmd(nic_del_cmd) |
if wait: |
logging.info("waiting for the guest to finish the unplug") |
- if not kvm_utils.wait_for(lambda: nic_id not in |
+ if not virt_utils.wait_for(lambda: nic_id not in |
vm.monitor.info("qtree"), |
guest_delay, 5 ,1): |
logging.error(vm.monitor.info("qtree")) |
@@ -109,7 +109,7 @@ def run_nic_hotplug(test, params, env): |
"hotplug module was loaded in guest") |
logging.info("Attach a virtio nic to vm") |
- mac = kvm_utils.generate_mac_address(vm.instance, 1) |
+ mac = virt_utils.generate_mac_address(vm.instance, 1) |
if not mac: |
mac = "00:00:02:00:00:02" |
netdev_id = netdev_add(vm) |
@@ -117,24 +117,24 @@ def run_nic_hotplug(test, params, env): |
if "Win" not in params.get("guest_name", ""): |
session.sendline("dhclient %s &" % |
- kvm_test_utils.get_linux_ifname(session, mac)) |
+ virt_test_utils.get_linux_ifname(session, mac)) |
logging.info("Shutting down the primary link") |
vm.monitor.cmd("set_link %s down" % vm.netdev_id[0]) |
try: |
logging.info("Waiting for new nic's ip address acquisition...") |
- if not kvm_utils.wait_for(lambda: (vm.address_cache.get(mac) is |
+ if not virt_utils.wait_for(lambda: (vm.address_cache.get(mac) is |
not None), 10, 1): |
raise error.TestFail("Could not get ip address of new nic") |
ip = vm.address_cache.get(mac) |
- if not kvm_utils.verify_ip_address_ownership(ip, mac): |
+ if not virt_utils.verify_ip_address_ownership(ip, mac): |
raise error.TestFail("Could not verify the ip address of new nic") |
else: |
logging.info("Got the ip address of new nic: %s", ip) |
logging.info("Ping test the new nic ...") |
- s, o = kvm_test_utils.ping(ip, 100) |
+ s, o = virt_test_utils.ping(ip, 100) |
if s != 0: |
logging.error(o) |
raise error.TestFail("New nic failed ping test") |