Checks connection failure to Qemu monitor.

This commit is contained in:
Jeremy committed 2015-01-11 18:24:13 -07:00
1 parent 14cc6d414f
commit 2ef45781ad
2 files changed
+10 -8

No files matched your search

+5 -1
View File
@@ -911,7 +911,11 @@ class QemuVM(object):
result = None
if self.is_running() and self._monitor:
log.debug("Execute QEMU monitor command: {}".format(command))
tn = telnetlib.Telnet(self._monitor_host, self._monitor, timeout=timeout)
try:
tn = telnetlib.Telnet(self._monitor_host, self._monitor, timeout=timeout)
except OSError as e:
log.warn("Could not connect to QEMU monitor: {}".format(e))
return result
try:
tn.write(command.encode('ascii') + b"\n")
time.sleep(0.1)