1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-01 04:38:12 +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 "" return ""
else: else:
try: 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) match = re.search("version\s+([0-9a-z\-\.]+)", output)
if match: if match:
version = match.group(1) version = match.group(1)

View File

@ -1601,18 +1601,19 @@ class QemuVM(BaseNode):
return network_options 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 [] return []
if len(os.environ.get("DISPLAY", "")) > 0: version = yield from self.manager.get_qemu_version(self.qemu_path)
return [] if version and parse_version(version) >= parse_version("3.0"):
if "-nographic" not in self._options: return ["-display", "none"]
else:
return ["-nographic"] return ["-nographic"]
return []
def _run_with_kvm(self, qemu_path, options): 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)) raise QemuError("Console type {} is unknown".format(self._console_type))
command.extend(self._monitor_options()) command.extend(self._monitor_options())
command.extend((yield from self._network_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: if additional_options:
try: try:
command.extend(shlex.split(additional_options)) command.extend(shlex.split(additional_options))