1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 03:08:14 +00:00

Fixes double display output in GRUB in QEMU v3.1. Fixes #1516.

This commit is contained in:
grossmj 2019-02-17 19:03:36 +08:00
parent 7fb192699b
commit 0b07299472
2 changed files with 11 additions and 9 deletions

View File

@ -186,7 +186,7 @@ class Qemu(BaseManager):
return ""
else:
try:
output = yield from subprocess_check_output(qemu_path, "-version")
output = yield from subprocess_check_output(qemu_path, "-version", "-nographic")
match = re.search("version\s+([0-9a-z\-\.]+)", output)
if match:
version = match.group(1)

View File

@ -1601,18 +1601,19 @@ class QemuVM(BaseNode):
return network_options
def _graphic(self):
@asyncio.coroutine
def _disable_graphics(self):
"""
Adds the correct graphic options depending of the OS
Disable graphics depending of the QEMU version
"""
if sys.platform.startswith("win"):
if any(opt in self._options for opt in ["-display", "-nographic", "-curses", "-sdl" "-spice", "-vnc"]):
return []
if len(os.environ.get("DISPLAY", "")) > 0:
return []
if "-nographic" not in self._options:
version = yield from self.manager.get_qemu_version(self.qemu_path)
if version and parse_version(version) >= parse_version("3.0"):
return ["-display", "none"]
else:
return ["-nographic"]
return []
def _run_with_kvm(self, qemu_path, options):
"""
@ -1678,7 +1679,8 @@ class QemuVM(BaseNode):
raise QemuError("Console type {} is unknown".format(self._console_type))
command.extend(self._monitor_options())
command.extend((yield from self._network_options()))
command.extend(self._graphic())
if self._console_type == "telnet":
command.extend((yield from self._disable_graphics()))
if additional_options:
try:
command.extend(shlex.split(additional_options))