提交 48038842 编写于 作者: L Lukáš Doktor 提交者: Lucas Meneghel Rodrigues

qemu.tests.qmp_*: Use VM.get_monitory_by_type() function

Use VM.get_monitory_by_type() function to get QMP monitor(s).
Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
上级 cb4b6587
......@@ -383,12 +383,10 @@ def run_qmp_basic(test, params, env):
vm.verify_alive()
# Look for the first qmp monitor available, otherwise, fail the test
qmp_monitor = None
for m in vm.monitors:
if isinstance(m, qemu_monitor.QMPMonitor):
qmp_monitor = m
if qmp_monitor is None:
qmp_monitor = vm.get_monitors_by_type("qmp")
if qmp_monitor:
qmp_monitor = qmp_monitor[0]
else:
raise error.TestError('Could not find a QMP monitor, aborting test')
# Run all suites
......
......@@ -369,12 +369,10 @@ def run_qmp_basic_rhel6(test, params, env):
vm.verify_alive()
# Look for the first qmp monitor available, otherwise, fail the test
qmp_monitor = None
for m in vm.monitors:
if isinstance(m, qemu_monitor.QMPMonitor):
qmp_monitor = m
if qmp_monitor is None:
qmp_monitor = vm.get_monitors_by_type("qmp")
if qmp_monitor:
qmp_monitor = qmp_monitor[0]
else:
raise error.TestError('Could not find a QMP monitor, aborting test')
# Run all suites
......
......@@ -47,11 +47,7 @@ def run_qmp_event_notification(test, params, env):
cmd_o = send_cmd(event_cmd)
end_time = time.time() + timeout
qmp_monitors = []
for monitor in vm.monitors:
monitor_params = params.object_params(monitor.name)
if monitor_params.get("monitor_type") == "qmp":
qmp_monitors += [monitor]
qmp_monitors = vm.get_monitors_by_type("qmp")
qmp_num = len(qmp_monitors)
logging.info("Try to get qmp events in %s seconds!" % timeout)
while time.time() < end_time:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册