Checks connection failure to Qemu monitor.

This commit is contained in:
Jeremy 2015-01-11 18:24:13 -07:00
parent 14cc6d414f
commit 2ef45781ad
2 changed files with 10 additions and 8 deletions

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)

View File

@ -778,16 +778,14 @@ class VirtualBoxVM(object):
"--register"]
result = self._execute("clonevm", args)
args = [self._name,
"take",
"reset"]
result = self._execute("snapshot", args)
log.debug("cloned VirtualBox VM: {}".format(result))
self._vmname = self._name
self._execute("setextradata", [self._vmname, "GNS3/Clone", "yes"])
log.debug("cloned VirtualBox VM: {}".format(result))
args = [self._name, "take", "reset"]
result = self._execute("snapshot", args)
log.debug("snapshot reset created: {}".format(result))
def _start_remote_console(self):
"""