From 0b07299472e1dc3e3adde386cd0b9ff33067f72b Mon Sep 17 00:00:00 2001 From: grossmj Date: Sun, 17 Feb 2019 19:03:36 +0800 Subject: [PATCH] Fixes double display output in GRUB in QEMU v3.1. Fixes #1516. --- gns3server/compute/qemu/__init__.py | 2 +- gns3server/compute/qemu/qemu_vm.py | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/gns3server/compute/qemu/__init__.py b/gns3server/compute/qemu/__init__.py index 4608fdd4..c11ceb81 100644 --- a/gns3server/compute/qemu/__init__.py +++ b/gns3server/compute/qemu/__init__.py @@ -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) diff --git a/gns3server/compute/qemu/qemu_vm.py b/gns3server/compute/qemu/qemu_vm.py index 16c9ebdf..4ee17f8a 100644 --- a/gns3server/compute/qemu/qemu_vm.py +++ b/gns3server/compute/qemu/qemu_vm.py @@ -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))