virt: Assorted bugfixes
cover virt: Assorted bugfixes
Fixes for a bunch of bugs I've noticed on our internal test farm.
Lucas Meneghel Rodrigues (3):
Fix wrong reference to image functions
virt.qemu_io: Make QemuIO inherit from object kvm.tests.qemu_io_blkdebug: Fix up use of python > 2.4 construct
client/tests/kvm/tests/enospc.py | 2 +- client/tests/kvm/tests/pci_hotplug.py | 4 ++-- client/tests/kvm/tests/physical_resources_check.py | 4 ++-- client/tests/kvm/tests/qemu_img.py | 4 ++-- client/tests/kvm/tests/qemu_io_blkdebug.py | 11 ++++++++--- client/virt/qemu_io.py | 2 +- 6 files changed, 16 insertions(+), 11 deletions(-)
Signature · 1 line
1.7.10
PATCH 1/3 Fix wrong reference to image functions
Now that they were moved to virt_utils.
Signed-off-by Lucas Meneghel Rodrigues <[email protected]>
--- client/tests/kvm/tests/enospc.py | 2 +- client/tests/kvm/tests/pci_hotplug.py | 4 ++-- client/tests/kvm/tests/physical_resources_check.py | 4 ++-- client/tests/kvm/tests/qemu_img.py | 4 ++-- client/tests/kvm/tests/qemu_io_blkdebug.py | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-)
client/tests/kvm/tests/enospc.py +1 -1
@@ -145,7 +145,7 @@ def run_enospc(test, params, env): for image_name in vm.params.objects("images"): image_params = vm.params.object_params(image_name) try: - virt_vm.check_image(image_params, test.bindir) + virt_utils.check_image(image_params, test.bindir) except (virt_vm.VMError, error.TestWarn), e: logging.error(e) logging.info("Guest paused, extending Logical Volume size")
client/tests/kvm/tests/pci_hotplug.py +2 -2
@@ -66,7 +66,7 @@ def run_pci_hotplug(test, params, env): pci_add_cmd = "pci_add pci_addr=auto nic model=%s" % tested_model elif test_type == "block": image_params = params.object_params("stg") - image_filename = virt_vm.get_image_filename(image_params, + image_filename = virt_utils.get_image_filename(image_params, test.bindir) pci_add_cmd = ("pci_add pci_addr=auto storage file=%s,if=%s" % (image_filename, tested_model))
@@ -89,7 +89,7 @@ def run_pci_hotplug(test, params, env): elif test_type == "block": image_params = params.object_params("stg") - image_filename = virt_vm.get_image_filename(image_params, + image_filename = virt_utils.get_image_filename(image_params, test.bindir) controller_model = None if tested_model == "virtio":
client/tests/kvm/tests/physical_resources_check.py +2 -2
@@ -1,6 +1,6 @@ import re, string, logging from autotest.client.shared import error -from autotest.client.virt import kvm_monitor, virt_vm +from autotest.client.virt import kvm_monitor, virt_utils def run_physical_resources_check(test, params, env):
@@ -98,7 +98,7 @@ def run_physical_resources_check(test, params, env): n_fail = [] # We will check HDs with the image name - image_name = virt_vm.get_image_filename(params, test.bindir) + image_name = virt_utils.get_image_filename(params, test.bindir) # Check cpu count logging.info("CPU count check")
client/tests/kvm/tests/qemu_img.py +2 -2
@@ -18,7 +18,7 @@ def run_qemu_img(test, params, env): raise error.TestError("Binary of 'qemu-img' not found") image_format = params.get("image_format") image_size = params.get("image_size", "10G") - image_name = virt_vm.get_image_filename(params, test.bindir) + image_name = virt_utils.get_image_filename(params, test.bindir) def _check(cmd, img):
@@ -402,7 +402,7 @@ def run_qemu_img(test, params, env): sn_fmt = params.get("snapshot_format", "qcow2") sn1 = params.get("image_name_snapshot1") sn1 = virt_utils.get_path(test.bindir, sn1) + ".%s" % sn_fmt - base_img = virt_vm.get_image_filename(params, test.bindir) + base_img = virt_utils.get_image_filename(params, test.bindir) _create(cmd, sn1, sn_fmt, base_img=base_img, base_img_fmt=image_format) # Create snapshot2 based on snapshot1
client/tests/kvm/tests/qemu_io_blkdebug.py +1 -1
@@ -32,7 +32,7 @@ def run_qemu_io_blkdebug(test, params, env): blkdebug_default = params.get("blkdebug_default") error.context("Create image", logging.info) - image_name = virt_vm.create_image(params.object_params(image), test.bindir) + image_name = virt_utils.create_image(params.object_params(image), test.bindir) template_name = virt_utils.get_path(test.virtdir, blkdebug_default) template = ConfigParser.ConfigParser()
Signature · 1 line
1.7.10
PATCH 2/3 virt.qemu_io: Make QemuIO inherit from object
In reply to Lucas Meneghel RodriguesConstructs like
MyClass():
Without explicit inheritance are not allowed on py 2.4.
Signed-off-by Lucas Meneghel Rodrigues <[email protected]>
--- client/virt/qemu_io.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
client/virt/qemu_io.py +1 -1
@@ -12,7 +12,7 @@ class QemuIOParamError(Exception): pass -class QemuIO(): +class QemuIO(object): """ A class for execute qemu-io command """
Signature · 1 line
1.7.10
PATCH 3/3 kvm.tests.qemu_io_blkdebug: Fix up use of python > 2.4 construct
In reply to Lucas Meneghel RodriguesReplace it with a larger, more boring, but nevertheless, working python 2.4 implementation.
Signed-off-by Lucas Meneghel Rodrigues <[email protected]>
--- client/tests/kvm/tests/qemu_io_blkdebug.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
client/tests/kvm/tests/qemu_io_blkdebug.py +7 -2
@@ -45,9 +45,14 @@ def run_qemu_io_blkdebug(test, params, env): template.set("inject-error", "event", '"%s"' % err_event) template.set("inject-error", "errno", '"%s"' % errn) - with open(blkdebug_cfg, 'w') as blkdebug: + error.context("Write blkdebug config file", logging.info) + blkdebug = None + try: + blkdebug = open(blkdebug_cfg, 'w') template.write(blkdebug) - blkdebug.close() + finally: + if blkdebug is not None: + blkdebug.close() error.context("Operate in qemu-io to trigger the error", logging.info) session = qemu_io.QemuIOShellSession(test, params, image_name,
Signature · 1 line
1.7.10