Fix timeout issue when creating Qemu disk image. Fixes https://github.com/GNS3/gns3-server/issues/2313

This commit is contained in:
grossmj 2023-11-05 15:41:46 +10:00
parent 3b22bcfe96
commit 191feed669
2 changed files with 5 additions and 0 deletions

View File

@ -26,6 +26,7 @@ import sys
import re import re
import subprocess import subprocess
from ...utils import shlex_quote
from ...utils.asyncio import subprocess_check_output from ...utils.asyncio import subprocess_check_output
from ...utils.get_resource import get_resource from ...utils.get_resource import get_resource
from ..base_manager import BaseManager from ..base_manager import BaseManager
@ -337,6 +338,8 @@ class Qemu(BaseManager):
command.append(path) command.append(path)
command.append("{}M".format(img_size)) 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) process = await asyncio.create_subprocess_exec(*command)
await process.wait() await process.wait()
except (OSError, subprocess.SubprocessError) as e: except (OSError, subprocess.SubprocessError) as e:

View File

@ -330,6 +330,8 @@ class WebServer:
try: try:
self._loop.run_forever() self._loop.run_forever()
except ConnectionResetError:
log.warning("Connection reset by peer")
except TypeError as e: except TypeError as e:
# This is to ignore an asyncio.windows_events exception # This is to ignore an asyncio.windows_events exception
# on Windows when the process gets the SIGBREAK signal # on Windows when the process gets the SIGBREAK signal