mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-24 17:28:08 +00:00
Handle -no-kvm param deprecated in Qemu >= v5.2
This commit is contained in:
parent
cdedd53339
commit
4646ce684f
@ -829,20 +829,26 @@ class QemuVM(BaseNode):
|
|||||||
id=self._id,
|
id=self._id,
|
||||||
options=options))
|
options=options))
|
||||||
|
|
||||||
if not sys.platform.startswith("linux"):
|
# "-no-kvm" and "-no-hax' are deprecated since Qemu v5.2
|
||||||
if "-no-kvm" in options:
|
if "-no-kvm" in options:
|
||||||
options = options.replace("-no-kvm", "")
|
options = options.replace("-no-kvm", "-machine accel=tcg")
|
||||||
|
if "-no-hax" in options:
|
||||||
|
options = options.replace("-no-hax", "-machine accel=tcg")
|
||||||
|
|
||||||
if "-enable-kvm" in options:
|
if "-enable-kvm" in options:
|
||||||
|
if not sys.platform.startswith("linux"):
|
||||||
|
# KVM can only be enabled on Linux
|
||||||
options = options.replace("-enable-kvm", "")
|
options = options.replace("-enable-kvm", "")
|
||||||
else:
|
else:
|
||||||
if "-no-hax" in options:
|
options = options.replace("-enable-kvm", "-machine accel=kvm")
|
||||||
options = options.replace("-no-hax", "")
|
|
||||||
if "-enable-hax" in options:
|
if "-enable-hax" in options:
|
||||||
|
if not sys.platform.startswith("win"):
|
||||||
|
# HAXM is only available on Windows
|
||||||
options = options.replace("-enable-hax", "")
|
options = options.replace("-enable-hax", "")
|
||||||
if "-icount" in options and ("-no-kvm" not in options):
|
else:
|
||||||
# automatically add the -no-kvm option if -icount is detected
|
options = options.replace("-enable-hax", "-machine accel=hax")
|
||||||
# to help with the migration of ASA VMs created before version 1.4
|
|
||||||
options = "-no-kvm " + options
|
|
||||||
self._options = options.strip()
|
self._options = options.strip()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -2078,7 +2084,7 @@ class QemuVM(BaseNode):
|
|||||||
if require_kvm is not None:
|
if require_kvm is not None:
|
||||||
require_hardware_accel = require_kvm
|
require_hardware_accel = require_kvm
|
||||||
|
|
||||||
if enable_hardware_accel and "-no-kvm" not in options and "-no-hax" not in options:
|
if enable_hardware_accel and "-machine accel=tcg" not in options:
|
||||||
# Turn OFF hardware acceleration for non x86 architectures
|
# Turn OFF hardware acceleration for non x86 architectures
|
||||||
if sys.platform.startswith("win"):
|
if sys.platform.startswith("win"):
|
||||||
supported_binaries = ["qemu-system-x86_64.exe", "qemu-system-x86_64w.exe", "qemu-system-i386.exe", "qemu-system-i386w.exe"]
|
supported_binaries = ["qemu-system-x86_64.exe", "qemu-system-x86_64w.exe", "qemu-system-i386.exe", "qemu-system-i386w.exe"]
|
||||||
|
@ -207,7 +207,7 @@ class QEMUHandler:
|
|||||||
enable_kvm = qemu_manager.config.get_section_config("Qemu").getboolean("enable_kvm")
|
enable_kvm = qemu_manager.config.get_section_config("Qemu").getboolean("enable_kvm")
|
||||||
if enable_kvm is not None:
|
if enable_kvm is not None:
|
||||||
hardware_accel = enable_kvm
|
hardware_accel = enable_kvm
|
||||||
if hardware_accel and "-no-kvm" not in vm.options and "-no-hax" not in vm.options:
|
if hardware_accel and "-machine accel=tcg" not in vm.options:
|
||||||
pm = ProjectManager.instance()
|
pm = ProjectManager.instance()
|
||||||
if pm.check_hardware_virtualization(vm) is False:
|
if pm.check_hardware_virtualization(vm) is False:
|
||||||
raise aiohttp.web.HTTPConflict(text="Cannot start VM with hardware acceleration (KVM/HAX) enabled because hardware virtualization (VT-x/AMD-V) is already used by another software like VMware or VirtualBox")
|
raise aiohttp.web.HTTPConflict(text="Cannot start VM with hardware acceleration (KVM/HAX) enabled because hardware virtualization (VT-x/AMD-V) is already used by another software like VMware or VirtualBox")
|
||||||
|
Loading…
Reference in New Issue
Block a user