From 928d9f13f44f31deeb725b2a9a17d581c3164e9c Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Wed, 16 Nov 2016 13:06:43 +0100 Subject: [PATCH] Do not log warning at qemu exit on windows if it's normal Fix #777 --- gns3server/compute/base_node.py | 12 +++++++++++- gns3server/compute/qemu/qemu_vm.py | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) 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