Skip to content

Commit

Permalink
virt.qemu_vm: Use monitor creation function in qemu_monitor
Browse files Browse the repository at this point in the history
Signed-off-by: Qingtang Zhou <[email protected]>
  • Loading branch information
zhouqt authored and lmr committed May 8, 2013
1 parent 551f4d2 commit 54681dc
Showing 1 changed file with 7 additions and 34 deletions.
41 changes: 7 additions & 34 deletions virttest/qemu_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1839,41 +1839,14 @@ def create(self, name=None, params=None, root_dir=None,
self.monitors = []
for monitor_name in params.objects("monitors"):
monitor_params = params.object_params(monitor_name)
# Wait for monitor connection to succeed
end_time = time.time() + timeout
while time.time() < end_time:
try:
if monitor_params.get("monitor_type") == "qmp":
if utils_misc.qemu_has_option("qmp",
self.qemu_binary):
# Add a QMP monitor
monitor = qemu_monitor.QMPMonitor(
monitor_name,
qemu_monitor.get_monitor_filename(self,
monitor_name))
else:
logging.warn("qmp monitor is unsupported, "
"using human monitor instead.")
# Add a "human" monitor
monitor = qemu_monitor.HumanMonitor(
monitor_name,
qemu_monitor.get_monitor_filename(self,
monitor_name))
else:
# Add a "human" monitor
monitor = qemu_monitor.HumanMonitor(
monitor_name,
qemu_monitor.get_monitor_filename(self,
monitor_name))
monitor.verify_responsive()
break
except qemu_monitor.MonitorError, e:
logging.warn(e)
time.sleep(1)
else:
e = qemu_monitor.MonitorConnectError(monitor_name)
try:
monitor = qemu_monitor.wait_for_create_monitor(self,
monitor_name, monitor_params, timeout)
except qemu_monitor.MonitorConnectError, detail:
logging.error(detail)
self.destroy()
raise e
raise

# Add this monitor to the list
self.monitors += [monitor]

Expand Down

0 comments on commit 54681dc

Please sign in to comment.