Permalink
Browse files

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

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

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
  • Loading branch information...
1 parent 6cc9231 commit d92090447bd2d386db05d874118b767928b79832 @lmr lmr committed Apr 26, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 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,

0 comments on commit d920904

Please sign in to comment.