fix: hardware acceleration support for ARM architectures in QEMU

This commit is contained in:
grossmj committed 2026-10-31 23:38:29 +07:00
1 parent f06166da71
commit af7b70001a
2 files changed
+27 -4

No files matched your search

+24 -3
View File
@@ -1057,12 +1057,27 @@ def test_get_qemu_img(vm, tmpdir):
@pytest.mark.asyncio
async def test_run_with_kvm(vm):
with patch("os.path.exists", return_value=True) as os_path:
with (
patch("gns3server.compute.qemu.qemu_vm.platform.machine", return_value="x86_64"),
patch("os.path.exists", return_value=True) as os_path,
):
vm.manager.config.settings.Qemu.enable_hardware_acceleration = True
assert await vm._run_with_hardware_acceleration("qemu-system-x86_64", "") is True
os_path.assert_called_with("/dev/kvm")
@pytest.mark.asyncio
async def test_run_with_kvm_arm64(vm):
with (
patch("gns3server.compute.qemu.qemu_vm.platform.machine", return_value="aarch64"),
patch("os.path.exists", return_value=True) as os_path,
):
vm.manager.config.settings.Qemu.enable_hardware_acceleration = True
assert await vm._run_with_hardware_acceleration("qemu-system-aarch64", "") is True
os_path.assert_called_with("/dev/kvm")
@pytest.mark.asyncio
async def test_run_with_kvm_options_no_kvm(vm):
@@ -1074,7 +1089,10 @@ async def test_run_with_kvm_options_no_kvm(vm):
@pytest.mark.asyncio
async def test_run_with_kvm_not_x86(vm):
with patch("os.path.exists", return_value=True):
with (
patch("gns3server.compute.qemu.qemu_vm.platform.machine", return_value="x86_64"),
patch("os.path.exists", return_value=True),
):
vm.manager.config.settings.Qemu.enable_hardware_acceleration = True
vm.manager.config.settings.Qemu.require_hardware_acceleration = True
with pytest.raises(QemuError):
@@ -1084,7 +1102,10 @@ async def test_run_with_kvm_not_x86(vm):
@pytest.mark.asyncio
async def test_run_with_kvm_dev_kvm_missing(vm):
with patch("os.path.exists", return_value=False):
with (
patch("gns3server.compute.qemu.qemu_vm.platform.machine", return_value="x86_64"),
patch("os.path.exists", return_value=False),
):
vm.manager.config.settings.Qemu.enable_hardware_acceleration = True
vm.manager.config.settings.Qemu.require_hardware_acceleration = True
with pytest.raises(QemuError):