ypu/autotest — comment on commit 7479b49e31e9b2d5fa464c0a8d051b7ccbbeedea
File: client/virt/qemu_io.py line 33
By ldoktor:

diff --git a/client/tests/kvm/tests/qemu_io_blkdebug.py b/client/tests/kvm/tests
index b5ada12..8e12e4b 100644
--- a/client/tests/kvm/tests/qemu_io_blkdebug.py
+++ b/client/tests/kvm/tests/qemu_io_blkdebug.py
@@ -51,14 +51,14 @@ def run_qemu_io_blkdebug(test, params, env):
blkdebug.close()

error.context("Operate in qemu-io to trigger the error", logging.info)
- session = qemu_io.QemuIOShellSession(test, image_name,
+ session = qemu_io.QemuIOShellSession(test, params, image_name,
blkdebug_cfg=blkdebug_cfg,
log_filename=log_filename)
if pre_err_commands:
for cmd in re.split(",", pre_err_commands.strip()):
session.cmd_output(cmd, timeout=test_timeout)

- output = session.cmd_output(err_command, timeout=test_timeout)
+ output = session.cmd_output(err_command, timeout=test_timeout)
error.context("Get error message from command perror", logging.info)
perror_cmd = "perror %s" % errn
stand = utils.system_output(perror_cmd)
@@ -82,6 +82,3 @@ def run_qemu_io_blkdebug(test, params, env):
else:
logging.warning("Can not find error message from perror."
" The output from qemu-io is %s" % output)
-
-
-
diff --git a/client/virt/qemu_io.py b/client/virt/qemu_io.py
index 20e17ee..a7e8a3e 100644
--- a/client/virt/qemu_io.py
+++ b/client/virt/qemu_io.py
@@ -17,7 +17,7 @@ class QemuIO():
A class for execute qemu-io command
"""

- def __init__(self, test, image_name, blkdebug_cfg="",
+ def __init__(self, test, params, image_name, blkdebug_cfg="",
prompt=r"qemu-io>\s*$", log_filename=None, io_options=""):
if log_filename:
log_filename += "-" + virt_utils.generate_random_string(4)
@@ -30,7 +30,10 @@ class QemuIO():
self.prompt=prompt
self.blkdebug_cfg=blkdebug_cfg

- self.qemu_io_cmd = virt_utils.get_path(test.bindir, "qemu-io")
+ #self.qemu_io_cmd = virt_utils.get_path(test.bindir, "qemu-io")
+ self.qemu_io_cmd = virt_utils.get_path(test.bindir,
+ params.get("qemu_io_binary",
+ "qemu-io"))

def cmd_output(self, command):
"""
@@ -48,9 +51,9 @@ class QemuIOShellSession(QemuIO):
"""
Use a shell session to execute qemu-io command
"""
- def __init__(self, test, image_name, blkdebug_cfg="",
+ def __init__(self, test, params, image_name, blkdebug_cfg="",
prompt=r"qemu-io>\s*$", log_filename=None, io_options=""):
- QemuIO.__init__(self, test, image_name, blkdebug_cfg, prompt,
+ QemuIO.__init__(self, test, params, image_name, blkdebug_cfg, prompt,
log_filename, io_options)

self.type = "shell"
@@ -117,9 +120,9 @@ class QemuIOSystem(QemuIO):
"""
Run qemu-io with a command line which will return immediately
"""
- def __init__(self, test, image_name, blkdebug_cfg="",
+ def __init__(self, test, params, image_name, blkdebug_cfg="",
prompt=r"qemu-io>\s*$", log_filename=None, io_options=""):
- QemuIO.__init__(self, test, image_name, blkdebug_cfg, prompt,
+ QemuIO.__init__(self, test, params, image_name, blkdebug_cfg, prompt,
log_filename, io_options)
no_warning_option = ["h", "help", "V", "version", "c", "cmd"]
ignore_option = ["c", "cmd"]

Works for me.