diff --git a/gns3server/compute/base_node.py b/gns3server/compute/base_node.py index b82c4cce..163a9ec7 100644 --- a/gns3server/compute/base_node.py +++ b/gns3server/compute/base_node.py @@ -333,7 +333,17 @@ class BaseNode: """ if not self._wrap_console: return - (reader, writer) = yield from asyncio.open_connection(host="127.0.0.1", port=self._internal_console_port) + remaining_trial = 60 + while True: + try: + (reader, writer) = yield from asyncio.open_connection(host="127.0.0.1", port=self._internal_console_port) + break + except (OSError, ConnectionRefusedError) as e: + print(self._internal_console_port) + if remaining_trial <= 0: + raise e + yield from asyncio.sleep(0.1) + remaining_trial -= 1 yield from AsyncioTelnetServer.write_client_intro(writer, echo=True) server = AsyncioTelnetServer(reader=reader, writer=writer, binary=True, echo=True) self._wrapper_telnet_server = yield from asyncio.start_server(server.run, self._manager.port_manager.console_host, self.console) diff --git a/gns3server/compute/qemu/qemu_vm.py b/gns3server/compute/qemu/qemu_vm.py index a9105eb7..4fc7f7bb 100644 --- a/gns3server/compute/qemu/qemu_vm.py +++ b/gns3server/compute/qemu/qemu_vm.py @@ -922,7 +922,8 @@ class QemuVM(BaseNode): self.status = "stopped" self._hw_virtualization = False self._process = None - if returncode != 0: + # A return code of 1 seem fine on Windows + if returncode != 0 and (returncode != 1 or not sys.platform.startswith("win")): self.project.emit("log.error", {"message": "QEMU process has stopped, return code: {}\n{}".format(returncode, self.read_stdout())}) @asyncio.coroutine