The heavy rearrangement the code base has suffered during the last few weeks produced some circular dependency chains, let's start to untangle the mess by cleaning and reorganizing the imports in the virt tests.
Signed-off-by: Lucas Meneghel Rodrigues <l...@redhat.com> --- client/tests/kvm/get_started.py | 4 +--- client/tests/kvm/tests/balloon_check.py | 3 ++- client/tests/kvm/tests/cgroup.py | 6 +----- client/tests/kvm/tests/cpuflags.py | 2 +- client/tests/kvm/tests/getfd.py | 1 - .../migration_multi_host_with_file_transfer.py | 4 ++-- .../migration_multi_host_with_speed_measurement.py | 2 +- .../tests/kvm/tests/migration_with_file_transfer.py | 2 +- .../kvm/tests/migration_with_speed_measurement.py | 2 +- client/tests/kvm/tests/multi_disk.py | 2 +- client/tests/kvm/tests/nic_bonding.py | 2 +- client/tests/kvm/tests/nic_hotplug.py | 4 ++-- client/tests/kvm/tests/pci_hotplug.py | 2 +- client/tests/kvm/tests/performance.py | 13 ++++++------- client/tests/kvm/tests/qemu_img.py | 3 +-- client/tests/kvm/tests/qemu_io_blkdebug.py | 1 - client/tests/kvm/tests/smbios_table.py | 4 ++-- client/tests/kvm/tests/system_reset_bootable.py | 2 +- client/tests/kvm/tests/usb.py | 19 +++++++++++++++---- client/tests/kvm/tests/virtio_console.py | 4 ++-- client/tests/libvirt/tests/virsh_capabilities.py | 4 ++-- client/virt/kvm_installer.py | 2 +- client/virt/kvm_qtree.py | 6 ++---- client/virt/kvm_storage.py | 9 ++------- client/virt/kvm_vm.py | 5 ++--- client/virt/libvirt_monitor.py | 2 +- client/virt/libvirt_storage.py | 8 -------- client/virt/libvirt_vm.py | 2 +- client/virt/passfd.py | 2 +- client/virt/qemu_io.py | 3 +-- client/virt/tests/boot.py | 5 +---- client/virt/tests/boot_savevm.py | 4 ++-- client/virt/tests/clock_getres.py | 1 - client/virt/tests/lvm.py | 2 +- client/virt/tests/module_probe.py | 2 +- client/virt/tests/negative_create.py | 6 ++++-- client/virt/tests/netperf.py | 9 ++++----- client/virt/tests/netstress_kill_guest.py | 2 +- client/virt/tests/nic_promisc.py | 4 +--- client/virt/tests/nicdriver_unload.py | 5 ++--- client/virt/tests/ntttcp.py | 5 ++--- client/virt/tests/remove_guest.py | 3 +-- client/virt/tests/shutdown.py | 2 +- client/virt/tests/trans_hugepage.py | 2 +- client/virt/tests/trans_hugepage_swapping.py | 1 - client/virt/tests/unattended_install.py | 4 ++-- client/virt/tests/watchdog.py | 2 +- client/virt/virt_env_process.py | 5 ++--- client/virt/virt_test.py | 3 +-- client/virt/virt_test_setup.py | 4 ++-- client/virt/virt_utils.py | 10 ++++------ client/virt/virt_utils_unittest.py | 2 +- client/virt/virt_vm.py | 4 ++-- 53 files changed, 92 insertions(+), 120 deletions(-) diff --git a/client/tests/kvm/get_started.py b/client/tests/kvm/get_started.py index ac272bb..174d9c8 100755 --- a/client/tests/kvm/get_started.py +++ b/client/tests/kvm/get_started.py @@ -4,13 +4,11 @@ Program to help setup kvm test environment @copyright: Red Hat 2010 """ -import os, sys, logging, shutil, glob +import os, sys try: import autotest.common as common except ImportError: import common -from autotest.client.shared import logging_manager -from autotest.client import utils from autotest.client.virt import virt_utils test_name = "kvm" diff --git a/client/tests/kvm/tests/balloon_check.py b/client/tests/kvm/tests/balloon_check.py index 0358b0a..b24606c 100644 --- a/client/tests/kvm/tests/balloon_check.py +++ b/client/tests/kvm/tests/balloon_check.py @@ -1,6 +1,7 @@ import re, logging, random, time from autotest.client.shared import error -from autotest.client.virt import kvm_monitor, virt_test_utils, aexpect +from autotest.client.virt import kvm_monitor, virt_test_utils + def run_balloon_check(test, params, env): """ diff --git a/client/tests/kvm/tests/cgroup.py b/client/tests/kvm/tests/cgroup.py index fd1b5dc..9ae4835 100644 --- a/client/tests/kvm/tests/cgroup.py +++ b/client/tests/kvm/tests/cgroup.py @@ -3,11 +3,7 @@ cgroup autotest test (on KVM guest) @author: Lukas Doktor <ldok...@redhat.com> @copyright: 2011 Red Hat, Inc. """ -import logging -import os -import re -import time -from random import random +import logging, os, re, time from autotest.client.shared import error from autotest.client import utils from autotest.client.tests.cgroup.cgroup_common import Cgroup diff --git a/client/tests/kvm/tests/cpuflags.py b/client/tests/kvm/tests/cpuflags.py index 941bbf0..fc5dbd8 100644 --- a/client/tests/kvm/tests/cpuflags.py +++ b/client/tests/kvm/tests/cpuflags.py @@ -1,4 +1,4 @@ -import logging, re, random, os, time, socket, pickle, sys, traceback +import logging, re, random, os, time, pickle, sys, traceback from autotest.client.shared import error, utils from autotest.client.virt import kvm_vm from autotest.client.virt import virt_utils, aexpect diff --git a/client/tests/kvm/tests/getfd.py b/client/tests/kvm/tests/getfd.py index 41b90cb..0f327ee 100644 --- a/client/tests/kvm/tests/getfd.py +++ b/client/tests/kvm/tests/getfd.py @@ -1,5 +1,4 @@ import os -import logging from autotest.client.shared import error diff --git a/client/tests/kvm/tests/migration_multi_host_with_file_transfer.py b/client/tests/kvm/tests/migration_multi_host_with_file_transfer.py index ec7dd60..996aea6 100644 --- a/client/tests/kvm/tests/migration_multi_host_with_file_transfer.py +++ b/client/tests/kvm/tests/migration_multi_host_with_file_transfer.py @@ -1,9 +1,9 @@ import logging, threading -from autotest.client.virt import virt_utils from autotest.client import utils as client_utils from autotest.client.shared import utils, error from autotest.client.shared.syncdata import SyncData -from autotest.client.virt import virt_env_process +from autotest.client.virt import virt_env_process, virt_utils + @error.context_aware def run_migration_multi_host_with_file_transfer(test, params, env): diff --git a/client/tests/kvm/tests/migration_multi_host_with_speed_measurement.py b/client/tests/kvm/tests/migration_multi_host_with_speed_measurement.py index 5a69bb3..887cfe3 100644 --- a/client/tests/kvm/tests/migration_multi_host_with_speed_measurement.py +++ b/client/tests/kvm/tests/migration_multi_host_with_speed_measurement.py @@ -1,5 +1,5 @@ import os, re, logging, time, socket -from autotest.client.virt import virt_utils, kvm_monitor +from autotest.client.virt import virt_utils from autotest.client.shared import error, utils from autotest.client.shared.barrier import listen_server from autotest.client.shared.syncdata import SyncData diff --git a/client/tests/kvm/tests/migration_with_file_transfer.py b/client/tests/kvm/tests/migration_with_file_transfer.py index 403680f..7141c3b 100644 --- a/client/tests/kvm/tests/migration_with_file_transfer.py +++ b/client/tests/kvm/tests/migration_with_file_transfer.py @@ -1,4 +1,4 @@ -import logging, time, os +import logging, os from autotest.client.shared import utils, error from autotest.client import utils as client_utils from autotest.client.virt import virt_utils diff --git a/client/tests/kvm/tests/migration_with_speed_measurement.py b/client/tests/kvm/tests/migration_with_speed_measurement.py index 30501b2..1b64e04 100644 --- a/client/tests/kvm/tests/migration_with_speed_measurement.py +++ b/client/tests/kvm/tests/migration_with_speed_measurement.py @@ -1,5 +1,5 @@ import os, re, logging, time -from autotest.client.virt import virt_utils, kvm_monitor +from autotest.client.virt import virt_utils from autotest.client.shared import error, utils diff --git a/client/tests/kvm/tests/multi_disk.py b/client/tests/kvm/tests/multi_disk.py index e4d7c3a..acf05f2 100644 --- a/client/tests/kvm/tests/multi_disk.py +++ b/client/tests/kvm/tests/multi_disk.py @@ -5,7 +5,7 @@ multi_disk test for Autotest framework. """ import logging, re, random, string from autotest.client.shared import error, utils -from autotest.client.virt import kvm_qtree, virt_storage, virt_env_process +from autotest.client.virt import kvm_qtree, virt_env_process _RE_RANGE1 = re.compile(r'range\([ ]*([-]?\d+|n).*\)') _RE_RANGE2 = re.compile(r',[ ]*([-]?\d+|n)') diff --git a/client/tests/kvm/tests/nic_bonding.py b/client/tests/kvm/tests/nic_bonding.py index 9fd6e0f..7972ce0 100644 --- a/client/tests/kvm/tests/nic_bonding.py +++ b/client/tests/kvm/tests/nic_bonding.py @@ -54,7 +54,7 @@ def run_nic_bonding(test, params, env): logging.info("Failover test with file transfer") transfer_thread = utils.InterruptedThread( - file_transfer.run_file_transfer, + virt_test_utils.run_file_transfer, (test, params, env)) try: transfer_thread.start() diff --git a/client/tests/kvm/tests/nic_hotplug.py b/client/tests/kvm/tests/nic_hotplug.py index 9274dae..628f8d5 100644 --- a/client/tests/kvm/tests/nic_hotplug.py +++ b/client/tests/kvm/tests/nic_hotplug.py @@ -1,6 +1,6 @@ -import logging, os +import logging from autotest.client.shared import error -from autotest.client.virt import virt_test_utils, virt_utils, virt_vm, aexpect +from autotest.client.virt import virt_test_utils, virt_vm, aexpect def run_nic_hotplug(test, params, env): diff --git a/client/tests/kvm/tests/pci_hotplug.py b/client/tests/kvm/tests/pci_hotplug.py index dddd59a..725179e 100644 --- a/client/tests/kvm/tests/pci_hotplug.py +++ b/client/tests/kvm/tests/pci_hotplug.py @@ -1,6 +1,6 @@ import re from autotest.client.shared import error -from autotest.client.virt import virt_utils, virt_vm, aexpect, virt_storage +from autotest.client.virt import virt_utils, aexpect, virt_storage def run_pci_hotplug(test, params, env): diff --git a/client/tests/kvm/tests/performance.py b/client/tests/kvm/tests/performance.py index bb0fa6b..13736cf 100644 --- a/client/tests/kvm/tests/performance.py +++ b/client/tests/kvm/tests/performance.py @@ -1,8 +1,7 @@ -import logging, time, os, re, commands, glob, string, sys, shutil +import os, re, commands, glob, shutil from autotest.client.shared import error from autotest.client import utils from autotest.client.virt import virt_test_utils -from autotest.client.virt.virt_test_utils import aton def run_performance(test, params, env): @@ -145,10 +144,10 @@ def ffsb_sum(topdir, prefix, params, guest_ver, resultsdir): iops = "%8s" % re.split("\s+", line)[0] elif marks[1] in line: substr = re.findall("\d+(?:\.\d+)*", line)[0] - readthro = aton("%.2f" % float(substr)) + readthro = virt_test_utils.aton("%.2f" % float(substr)) elif marks[2] in line: substr = re.findall("\d+(?:\.\d+)*", line)[0] - writethro = aton("%.2f" % float(substr)) + writethro = virt_test_utils.aton("%.2f" % float(substr)) break throughput = readthro + writethro @@ -158,12 +157,12 @@ def ffsb_sum(topdir, prefix, params, guest_ver, resultsdir): file = glob.glob(os.path.join(sub_dir, "guest_monitor_result*.sum"))[0] str = open(file, "r").readlines() - linestr.append("%8.2f" % (100 - aton(str[1].split()[3]))) - linestr.append("%8.2f" % (100 - aton(str[2].split()[3]))) + linestr.append("%8.2f" % (100 - virt_test_utils.aton(str[1].split()[3]))) + linestr.append("%8.2f" % (100 - virt_test_utils.aton(str[2].split()[3]))) file = glob.glob(os.path.join(sub_dir, "host_monitor_result*.sum"))[0] str = open(file, "r").readlines() - hostcpu = 100 - aton(str[-1].split()[3]) + hostcpu = 100 - virt_test_utils.aton(str[-1].split()[3]) linestr.append(hostcpu) sum_hostcpu += hostcpu linestr.append("%.2f" % (throughput/hostcpu)) diff --git a/client/tests/kvm/tests/qemu_img.py b/client/tests/kvm/tests/qemu_img.py index 792e0c5..e3a1bf4 100644 --- a/client/tests/kvm/tests/qemu_img.py +++ b/client/tests/kvm/tests/qemu_img.py @@ -1,7 +1,6 @@ import re, os, logging, commands from autotest.client.shared import utils, error -from autotest.client.virt import virt_vm, virt_utils, virt_env_process -from autotest.client.virt import virt_storage +from autotest.client.virt import virt_utils, virt_env_process, virt_storage def run_qemu_img(test, params, env): diff --git a/client/tests/kvm/tests/qemu_io_blkdebug.py b/client/tests/kvm/tests/qemu_io_blkdebug.py index 0a087c6..fbe0998 100644 --- a/client/tests/kvm/tests/qemu_io_blkdebug.py +++ b/client/tests/kvm/tests/qemu_io_blkdebug.py @@ -1,7 +1,6 @@ import re, logging, ConfigParser from autotest.client.shared import error from autotest.client.virt import qemu_io -from autotest.client.virt import virt_vm from autotest.client.virt import virt_utils from autotest.client.virt.kvm_storage import QemuImg from autotest.client import utils diff --git a/client/tests/kvm/tests/smbios_table.py b/client/tests/kvm/tests/smbios_table.py index 098030a..9494365 100644 --- a/client/tests/kvm/tests/smbios_table.py +++ b/client/tests/kvm/tests/smbios_table.py @@ -1,6 +1,6 @@ -import commands, logging +import logging from autotest.client.shared import utils, error -from autotest.client.virt import virt_env_process, virt_test_utils +from autotest.client.virt import virt_env_process @error.context_aware diff --git a/client/tests/kvm/tests/system_reset_bootable.py b/client/tests/kvm/tests/system_reset_bootable.py index 0d6d377..677a053 100644 --- a/client/tests/kvm/tests/system_reset_bootable.py +++ b/client/tests/kvm/tests/system_reset_bootable.py @@ -1,5 +1,5 @@ import logging, time -from autotest.client.shared import error + def run_system_reset_bootable(test, params, env): """ diff --git a/client/tests/kvm/tests/usb.py b/client/tests/kvm/tests/usb.py index 64df308..c07d026 100644 --- a/client/tests/kvm/tests/usb.py +++ b/client/tests/kvm/tests/usb.py @@ -163,7 +163,11 @@ def run_usb(test, params, env): session = _login() output = session.cmd("ls -l /dev/disk/by-path/* | grep usb").strip() devname = re.findall("sd\w", output) - cmd = "dmesg | grep %s" % devname[0] if devname else "sda" + if devname: + d = devname[0] + else: + d = "sda" + cmd = "dmesg | grep %s" % d output = session.cmd(cmd) _verify_string(expect_str, output, [expect_str]) _do_io_test_guest(session) @@ -190,12 +194,19 @@ def run_usb(test, params, env): session = _login() output = session.cmd("ls -l /dev/disk/by-path/* | grep usb").strip() devname = re.findall("sd\w", output) - cmd = "cat /sys/block/%s/queue/{minimum,optimal}_io_size" % \ - (devname[0] if devname else "sda") + if devname: + d = devname[0] + else: + d = 'sda' + cmd = ("cat /sys/block/%s/queue/{minimum,optimal}_io_size" % d) + output = session.cmd(cmd) # Note: If set min_io_size = 0, guest min_io_size would be set to # 512 by default. - expected_min_size = min_io_size if min_io_size != "0" else "512" + if min_io_size != "0": + expected_min_size = min_io_size + else: + expected_min_size = "512" _verify_string("(\d+)\n(\d+)", output, [expected_min_size, opt_io_size]) _do_io_test_guest(session) diff --git a/client/tests/kvm/tests/virtio_console.py b/client/tests/kvm/tests/virtio_console.py index b1b1d01..c36e182 100644 --- a/client/tests/kvm/tests/virtio_console.py +++ b/client/tests/kvm/tests/virtio_console.py @@ -10,8 +10,8 @@ from threading import Thread from autotest.client.shared import error from autotest.client import utils -from autotest.client.virt import virt_utils, virt_test_utils, kvm_monitor -from autotest.client.virt import virt_env_process, aexpect +from autotest.client.virt import virt_test_utils, kvm_monitor, virt_env_process +from autotest.client.virt import aexpect def run_virtio_console(test, params, env): diff --git a/client/tests/libvirt/tests/virsh_capabilities.py b/client/tests/libvirt/tests/virsh_capabilities.py index 7e661f8..c58a599 100644 --- a/client/tests/libvirt/tests/virsh_capabilities.py +++ b/client/tests/libvirt/tests/virsh_capabilities.py @@ -1,5 +1,5 @@ -import logging, commands, re -from xml.dom.minidom import parse, parseString +import logging, re +from xml.dom.minidom import parseString from autotest.client.shared import utils, error from autotest.client.virt import libvirt_vm diff --git a/client/virt/kvm_installer.py b/client/virt/kvm_installer.py index b975f31..f9b081c 100644 --- a/client/virt/kvm_installer.py +++ b/client/virt/kvm_installer.py @@ -7,7 +7,7 @@ See BaseInstaller class in base_installer.py for interface details. import os, logging from autotest.client import utils from autotest.client.shared import error -from autotest.client.virt import base_installer +import base_installer __all__ = ['GitRepoInstaller', 'LocalSourceDirInstaller', diff --git a/client/virt/kvm_qtree.py b/client/virt/kvm_qtree.py index d35cdff..406c02e 100644 --- a/client/virt/kvm_qtree.py +++ b/client/virt/kvm_qtree.py @@ -4,10 +4,8 @@ Utility classes and functions to handle KVM Qtree parsing and verification. @author: Lukas Doktor <ldok...@redhat.com> @copyright: 2012 Red Hat Inc. """ -import logging -import os -import re -from autotest.client.virt import virt_storage +import logging, os, re +import virt_storage OFFSET_PER_LEVEL = 2 diff --git a/client/virt/kvm_storage.py b/client/virt/kvm_storage.py index 053dd3d..b2c93b1 100644 --- a/client/virt/kvm_storage.py +++ b/client/virt/kvm_storage.py @@ -5,15 +5,10 @@ This exports: - two functions for get image/blkdebug filename - class for image operates and basic parameters """ -import logging -import os -import shutil -import re +import logging, os from autotest.client.shared import error from autotest.client import utils -import virt_utils -import virt_vm -import virt_storage +import virt_utils, virt_vm, virt_storage class QemuImg(virt_storage.QemuImg): diff --git a/client/virt/kvm_vm.py b/client/virt/kvm_vm.py index 431f3a0..6e784d0 100644 --- a/client/virt/kvm_vm.py +++ b/client/virt/kvm_vm.py @@ -4,11 +4,10 @@ Utility classes and functions to handle Virtual Machine creation using qemu. @copyright: 2008-2009 Red Hat Inc. """ -import time, os, logging, fcntl, re, commands, glob +import time, os, logging, fcntl, re, commands from autotest.client.shared import error from autotest.client import utils -import virt_utils, virt_vm, virt_test_setup, kvm_monitor, aexpect -import virt_storage +import virt_utils, virt_vm, virt_test_setup, virt_storage, kvm_monitor, aexpect class VM(virt_vm.BaseVM): diff --git a/client/virt/libvirt_monitor.py b/client/virt/libvirt_monitor.py index 854f2f4..be3f9ca 100644 --- a/client/virt/libvirt_monitor.py +++ b/client/virt/libvirt_monitor.py @@ -1,6 +1,6 @@ import re, tempfile, xml.dom.minidom, logging -import virt_utils, aexpect from autotest.client import utils +import virt_utils, aexpect class VirshMonitor: diff --git a/client/virt/libvirt_storage.py b/client/virt/libvirt_storage.py index da72ac7..ee3c9c9 100644 --- a/client/virt/libvirt_storage.py +++ b/client/virt/libvirt_storage.py @@ -5,14 +5,6 @@ This exports: - two functions for get image/blkdebug filename - class for image operates and basic parameters """ -import logging -import os -import shutil -import re -from autotest.client.shared import error -from autotest.client import utils -import virt_utils -import virt_vm import virt_storage diff --git a/client/virt/libvirt_vm.py b/client/virt/libvirt_vm.py index a1b8c16..5b8a8b6 100644 --- a/client/virt/libvirt_vm.py +++ b/client/virt/libvirt_vm.py @@ -8,7 +8,7 @@ import time, os, logging, fcntl, re, commands, shutil, urlparse from autotest.client.shared import error from autotest.client import utils, os_dep from xml.dom import minidom -import virt_utils, virt_vm, aexpect, virt_storage +import virt_utils, virt_vm, virt_storage, aexpect DEBUG = False try: diff --git a/client/virt/passfd.py b/client/virt/passfd.py index 1cf90f2..0417357 100644 --- a/client/virt/passfd.py +++ b/client/virt/passfd.py @@ -37,7 +37,7 @@ For more information, see one of the R. Stevens' books: # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -import os, socket +import socket import _passfd diff --git a/client/virt/qemu_io.py b/client/virt/qemu_io.py index 7c0b10a..4ad0d2e 100644 --- a/client/virt/qemu_io.py +++ b/client/virt/qemu_io.py @@ -1,8 +1,7 @@ import re, logging from autotest.client.shared import error from autotest.client import utils -import aexpect -import virt_utils +import virt_utils, aexpect class QemuIOParamError(Exception): diff --git a/client/virt/tests/boot.py b/client/virt/tests/boot.py index 0a003ac..7b3862a 100644 --- a/client/virt/tests/boot.py +++ b/client/virt/tests/boot.py @@ -1,7 +1,4 @@ -import time -import sys -import re - +import time, sys, re from autotest.client.shared import error from autotest.client.virt import virt_test_utils diff --git a/client/virt/tests/boot_savevm.py b/client/virt/tests/boot_savevm.py index b423ec5..994db50 100644 --- a/client/virt/tests/boot_savevm.py +++ b/client/virt/tests/boot_savevm.py @@ -1,6 +1,6 @@ -import logging, time, tempfile, os.path +import logging, time, tempfile, os from autotest.client.shared import error -from autotest.client.virt import virt_utils + def run_boot_savevm(test, params, env): """ diff --git a/client/virt/tests/clock_getres.py b/client/virt/tests/clock_getres.py index 044510d..e60e601 100644 --- a/client/virt/tests/clock_getres.py +++ b/client/virt/tests/clock_getres.py @@ -1,6 +1,5 @@ import logging, os from autotest.client.shared import error -from autotest.client import utils def run_clock_getres(test, params, env): diff --git a/client/virt/tests/lvm.py b/client/virt/tests/lvm.py index d18eb93..cf189e8 100644 --- a/client/virt/tests/lvm.py +++ b/client/virt/tests/lvm.py @@ -1,4 +1,4 @@ -import logging, os +import os from autotest.client.shared import error diff --git a/client/virt/tests/module_probe.py b/client/virt/tests/module_probe.py index 57ca6ad..0ca89cf 100644 --- a/client/virt/tests/module_probe.py +++ b/client/virt/tests/module_probe.py @@ -1,4 +1,4 @@ -import re, commands, logging, os +import logging from autotest.client.shared import error, utils from autotest.client.virt import base_installer diff --git a/client/virt/tests/negative_create.py b/client/virt/tests/negative_create.py index b0e26b4..4e7c997 100644 --- a/client/virt/tests/negative_create.py +++ b/client/virt/tests/negative_create.py @@ -1,10 +1,12 @@ import logging from autotest.client.virt import virt_vm, virt_utils + class VMCreateSuccess(Exception): def __str__(self): return "VM succeeded to create. This was not expected" + def run_negative_create(test, params, env): """ @param test: kvm test object @@ -21,9 +23,9 @@ def run_negative_create(test, params, env): main_vm = env.get_vm(params["main_vm"]) try: main_vm.create(params["main_vm"]) - except (virt_vm.VMError, virt_utils.NetError) as err: + except (virt_vm.VMError, virt_utils.NetError), err: logging.debug("VM Failed to create. This was expected. Reason:\n%s", - str(err)) + str(err)) else: main_vm.destroy() raise VMCreateSuccess() diff --git a/client/virt/tests/netperf.py b/client/virt/tests/netperf.py index 31e385f..d483d61 100644 --- a/client/virt/tests/netperf.py +++ b/client/virt/tests/netperf.py @@ -1,9 +1,8 @@ -import logging, os, commands, sys, threading, re, glob -from autotest.client.shared import error -from autotest.client import utils -from autotest.client.virt import aexpect, virt_utils -from autotest.client.virt import virt_test_utils +import logging, os, commands, threading, re, glob from autotest.server.hosts.ssh_host import SSHHost +from autotest.client import utils +from autotest.client.virt import virt_test_utils, virt_utils + def run_netperf(test, params, env): """ diff --git a/client/virt/tests/netstress_kill_guest.py b/client/virt/tests/netstress_kill_guest.py index 21cb097..4b267da 100644 --- a/client/virt/tests/netstress_kill_guest.py +++ b/client/virt/tests/netstress_kill_guest.py @@ -1,7 +1,7 @@ import logging, os, signal, re, time from autotest.client.shared import error from autotest.client import utils -from autotest.client.virt import aexpect, virt_utils +from autotest.client.virt import aexpect def run_netstress_kill_guest(test, params, env): diff --git a/client/virt/tests/nic_promisc.py b/client/virt/tests/nic_promisc.py index fefa3f6..369512c 100644 --- a/client/virt/tests/nic_promisc.py +++ b/client/virt/tests/nic_promisc.py @@ -1,7 +1,5 @@ -import logging, threading -from autotest.client.shared import error from autotest.client import utils -from autotest.client.virt import virt_test_utils, virt_utils +from autotest.client.virt import virt_test_utils def run_nic_promisc(test, params, env): diff --git a/client/virt/tests/nicdriver_unload.py b/client/virt/tests/nicdriver_unload.py index 37980a0..732bff6 100644 --- a/client/virt/tests/nicdriver_unload.py +++ b/client/virt/tests/nicdriver_unload.py @@ -1,7 +1,6 @@ -import logging, threading, os, time -from autotest.client.shared import error +import logging, os, time from autotest.client import utils -from autotest.client.virt import virt_test_utils, virt_utils +from autotest.client.virt import virt_test_utils def run_nicdriver_unload(test, params, env): diff --git a/client/virt/tests/ntttcp.py b/client/virt/tests/ntttcp.py index 451e4a5..92d3a9f 100644 --- a/client/virt/tests/ntttcp.py +++ b/client/virt/tests/ntttcp.py @@ -167,9 +167,8 @@ def run_ntttcp(test, params, env): f = open("%s.RHS" % results_path, "w") raw = " buf(k)| throughput(Mbit/s)" logging.info(raw) - fd.write("#ver# %s\n#ver# host kernel: %s%s\n" % ( - commands.getoutput("rpm -q qemu-kvm"), - os.uname()[2])) + f.write("#ver# %s\n#ver# host kernel: %s%s\n" % + (commands.getoutput("rpm -q qemu-kvm"), os.uname()[2])) desc = """#desc# The tests are sessions of "NTttcp", send buf number is %s. 'throughput' was taken from ntttcp's report. #desc# How to read the results: #desc# - The Throughput is measured in Mbit/sec. diff --git a/client/virt/tests/remove_guest.py b/client/virt/tests/remove_guest.py index 08e1c8d..4479ffa 100644 --- a/client/virt/tests/remove_guest.py +++ b/client/virt/tests/remove_guest.py @@ -1,6 +1,4 @@ -import logging, time from autotest.client.shared import error -from autotest.client.virt import virt_utils @error.context_aware @@ -8,3 +6,4 @@ def run_remove_guest(test, params, env): """ everything is done by client.virt module """ + pass diff --git a/client/virt/tests/shutdown.py b/client/virt/tests/shutdown.py index 493e351..5842779 100644 --- a/client/virt/tests/shutdown.py +++ b/client/virt/tests/shutdown.py @@ -1,4 +1,4 @@ -import logging, time +import time from autotest.client.shared import error from autotest.client.virt import virt_utils diff --git a/client/virt/tests/trans_hugepage.py b/client/virt/tests/trans_hugepage.py index 2ebceeb..14d0422 100644 --- a/client/virt/tests/trans_hugepage.py +++ b/client/virt/tests/trans_hugepage.py @@ -1,7 +1,7 @@ import logging, os, re from autotest.client.shared import error from autotest.client.shared import utils -from autotest.client.virt import aexpect, virt_test_utils +from autotest.client.virt import virt_test_utils @error.context_aware diff --git a/client/virt/tests/trans_hugepage_swapping.py b/client/virt/tests/trans_hugepage_swapping.py index d1415b1..b3841fe 100644 --- a/client/virt/tests/trans_hugepage_swapping.py +++ b/client/virt/tests/trans_hugepage_swapping.py @@ -1,7 +1,6 @@ import logging, os, re from autotest.client.shared import error from autotest.client import utils -from autotest.client.virt import virt_utils, virt_test_utils from autotest.client.virt import virt_env_process diff --git a/client/virt/tests/unattended_install.py b/client/virt/tests/unattended_install.py index 4b6c988..02a056c 100644 --- a/client/virt/tests/unattended_install.py +++ b/client/virt/tests/unattended_install.py @@ -1,10 +1,10 @@ -import logging, time, socket, re, os, shutil, tempfile, glob, ConfigParser +import logging, time, re, os, shutil, tempfile, glob, ConfigParser import threading import xml.dom.minidom from autotest.client.shared import error, iso9660 from autotest.client import utils from autotest.client.virt import virt_vm, virt_utils, virt_http_server -from autotest.client.virt import libvirt_vm, kvm_monitor +from autotest.client.virt import kvm_monitor # Whether to print all shell commands called diff --git a/client/virt/tests/watchdog.py b/client/virt/tests/watchdog.py index 6463962..6717391 100644 --- a/client/virt/tests/watchdog.py +++ b/client/virt/tests/watchdog.py @@ -1,4 +1,4 @@ -import logging, time, shutil +import logging from autotest.client.shared import error from autotest.client.virt import virt_utils diff --git a/client/virt/virt_env_process.py b/client/virt/virt_env_process.py index f947159..2be83c6 100644 --- a/client/virt/virt_env_process.py +++ b/client/virt/virt_env_process.py @@ -1,9 +1,8 @@ import os, time, commands, re, logging, glob, threading, shutil from autotest.client import utils from autotest.client.shared import error -import aexpect, virt_utils, kvm_monitor, ppm_utils, virt_test_setup -import virt_vm, kvm_vm, libvirt_vm, virt_video_maker, virt_utils, virt_storage -import kvm_storage +import aexpect, kvm_monitor, ppm_utils, virt_test_setup, virt_vm, kvm_vm +import libvirt_vm, virt_video_maker, virt_utils, virt_storage, kvm_storage try: import PIL.Image diff --git a/client/virt/virt_test.py b/client/virt/virt_test.py index cf43359..0e97307 100644 --- a/client/virt/virt_test.py +++ b/client/virt/virt_test.py @@ -1,8 +1,7 @@ import os, sys, logging, imp - from autotest.client import test from autotest.client.shared import error -from autotest.client.virt import virt_utils, virt_env_process +import virt_utils, virt_env_process class virt_test(test.test): diff --git a/client/virt/virt_test_setup.py b/client/virt/virt_test_setup.py index cb76cca..54e0bf7 100644 --- a/client/virt/virt_test_setup.py +++ b/client/virt/virt_test_setup.py @@ -2,9 +2,9 @@ Library to perform pre/post test setup for KVM autotest. """ import os, logging, time, re, random, commands -import virt_utils from autotest.client.shared import error -from autotest.client import utils +from autotest.client import utils, kvm_control +import virt_utils class THPError(Exception): diff --git a/client/virt/virt_utils.py b/client/virt/virt_utils.py index 88a866c..e09d2f0 100644 --- a/client/virt/virt_utils.py +++ b/client/virt/virt_utils.py @@ -6,14 +6,12 @@ Virtualization test utility functions. import time, string, random, socket, os, signal, re, logging, commands, cPickle import fcntl, shelve, ConfigParser, threading, sys, UserDict, inspect, tarfile -import struct, shutil, glob, HTMLParser, urllib, traceback +import struct, shutil, glob, HTMLParser, urllib, traceback, platform from autotest.client import utils, os_dep from autotest.client.shared import error, logging_config from autotest.client.shared import logging_manager, git -from autotest.client.virt import virt_env_process, virt_vm from autotest.client.shared.syncdata import SyncData, SyncListenServer -import rss_client, aexpect -import platform +import rss_client, aexpect, virt_env_process, virt_storage try: import koji @@ -4707,7 +4705,7 @@ def preprocess_images(bindir, params, env): vm.destroy(free_mac_addresses=False) vm_params = params.object_params(vm_name) for image in vm_params.get("master_images_clone").split(): - image_obj = virt_image.QemuImg(params, bindir, image) + image_obj = virt_storage.QemuImg(params, bindir, image) image_obj.clone_image(params, vm_name, image, bindir) @@ -4715,7 +4713,7 @@ def postprocess_images(bindir, params): for vm in params.get("vms").split(): vm_params = params.object_params(vm) for image in vm_params.get("master_images_clone").split(): - image_obj = virt_image.QemuImg(params, bindir, image) + image_obj = virt_storage.QemuImg(params, bindir, image) image_obj.rm_clone_image(params, vm, image, bindir) diff --git a/client/virt/virt_utils_unittest.py b/client/virt/virt_utils_unittest.py index 37ca246..5cb3930 100755 --- a/client/virt/virt_utils_unittest.py +++ b/client/virt/virt_utils_unittest.py @@ -1,6 +1,6 @@ #!/usr/bin/python -import unittest, logging, time, sys, os, shelve +import unittest, time, sys, os, shelve import common from autotest.client.virt import virt_utils from autotest.client import utils diff --git a/client/virt/virt_vm.py b/client/virt/virt_vm.py index 59435a6..586602d 100644 --- a/client/virt/virt_vm.py +++ b/client/virt/virt_vm.py @@ -1,8 +1,8 @@ -import os, logging, time, glob, re, shutil +import logging, time, glob, re from autotest.client.shared import error -from autotest.client import utils import virt_utils + class VMError(Exception): pass -- 1.7.10.2 _______________________________________________ Autotest mailing list Autotest@test.kernel.org http://test.kernel.org/cgi-bin/mailman/listinfo/autotest