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

pull/1540/head
grossmj 5 years ago
parent 7fb192699b
commit 0b07299472

@ -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)

@ -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"):
return []
if len(os.environ.get("DISPLAY", "")) > 0:
if any(opt in self._options for opt in ["-display", "-nographic", "-curses", "-sdl" "-spice", "-vnc"]):
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))

Loading…
Cancel
Save