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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Lucas Meneghel Rodrigues <lmr@xxxxxxxxxx>
---
 client/tests/kvm/tests/qemu_io_blkdebug.py |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/client/tests/kvm/tests/qemu_io_blkdebug.py b/client/tests/kvm/tests/qemu_io_blkdebug.py
index b838225..6a057f4 100644
--- a/client/tests/kvm/tests/qemu_io_blkdebug.py
+++ b/client/tests/kvm/tests/qemu_io_blkdebug.py
@@ -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,
-- 
1.7.10

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux