提交 970966c0 编写于 作者: X Xu Tian

qemu.tests.drive_mirror: fix syntax when job status is empty

Check block job status not empty to avoid 'KeyError: 'len' when qmp
monitor respone delay.
Signed-off-by: NXu Tian <xutian@redhat.com>
上级 98975075
......@@ -79,7 +79,9 @@ class BlockCopy(object):
"""
return block job info dict;
"""
return self.vm.get_job_status(self.device)
query_status = lambda: self.vm.get_job_status(self.device)
status = utils_misc.wait_for(query_status, timeout=120)
return status or {}
def do_steps(self, tag=None):
if not tag:
......
......@@ -106,7 +106,7 @@ class DriveMirror(block_copy.BlockCopy):
"""
params = self.parser_test_args()
info = self.get_status()
ret = (info["len"] == info["offset"])
ret = bool(info and info["len"] == info["offset"])
if self.vm.monitor.protocol == "qmp":
if params.get("check_event", "no") == "yes":
ret &= bool(self.vm.monitor.get_event("BLOCK_JOB_READY"))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册