Skip to contentSkip to conversation

virt: Assorted bugfixes

PATCH New Lucas Meneghel Rodrigues 1 participant 4 messages Apr 26, 2012 KVM

lore
Share & tools
lore
#0 lore raw

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
#1 lore raw

PATCH 1/3 Fix wrong reference to image functions

Now that they were moved to virt_utils.

---
 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
index b4740a4..a011091 100644
@@ -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
index 6908134..4316d51 100644
@@ -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
index 4e0bb72..076139c 100644
@@ -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
index 47ae20f..bf108bc 100644
@@ -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
index 01830e3..b838225 100644
@@ -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
#2 lore raw

PATCH 2/3 virt.qemu_io: Make QemuIO inherit from object

In reply to Lucas Meneghel Rodrigues

Constructs like

MyClass():

Without explicit inheritance are not allowed on py 2.4.

---
 client/virt/qemu_io.py |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
client/virt/qemu_io.py +1 -1
index 8f56f4d..7c0b10a 100644
@@ -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
#3 lore raw

PATCH 3/3 kvm.tests.qemu_io_blkdebug: Fix up use of python > 2.4 construct

In reply to Lucas Meneghel Rodrigues

Replace it with a larger, more boring, but nevertheless, working python 2.4 implementation.

---
 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
index b838225..6a057f4 100644
@@ -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