From fe246cd413eff565b61f2bd9e0ee524efaa1d9f5 Mon Sep 17 00:00:00 2001 From: grossmj Date: Sun, 5 Nov 2023 15:41:46 +1000 Subject: [PATCH] Fix timeout issue when creating Qemu disk image. Fixes https://github.com/GNS3/gns3-server/issues/2313 --- gns3server/compute/qemu/__init__.py | 3 +++ gns3server/web/web_server.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/gns3server/compute/qemu/__init__.py b/gns3server/compute/qemu/__init__.py index d377fd6e..542611d5 100644 --- a/gns3server/compute/qemu/__init__.py +++ b/gns3server/compute/qemu/__init__.py @@ -26,6 +26,7 @@ import sys import re import subprocess +from ...utils import shlex_quote from ...utils.asyncio import subprocess_check_output from ...utils.get_resource import get_resource from ..base_manager import BaseManager @@ -337,6 +338,8 @@ class Qemu(BaseManager): command.append(path) command.append("{}M".format(img_size)) + command_string = " ".join(shlex_quote(s) for s in command) + log.info("Creating disk image with {}".format(command_string)) process = await asyncio.create_subprocess_exec(*command) await process.wait() except (OSError, subprocess.SubprocessError) as e: diff --git a/gns3server/web/web_server.py b/gns3server/web/web_server.py index 5d58ffcf..7d14063a 100644 --- a/gns3server/web/web_server.py +++ b/gns3server/web/web_server.py @@ -330,6 +330,8 @@ class WebServer: try: self._loop.run_forever() + except ConnectionResetError: + log.warning("Connection reset by peer") except TypeError as e: # This is to ignore an asyncio.windows_events exception # on Windows when the process gets the SIGBREAK signal