diff --git a/gns3server/modules/qemu/qemu_vm.py b/gns3server/modules/qemu/qemu_vm.py index 310a2223..6a1995a1 100644 --- a/gns3server/modules/qemu/qemu_vm.py +++ b/gns3server/modules/qemu/qemu_vm.py @@ -80,10 +80,12 @@ class QemuVM(BaseVM): try: self.qemu_path = qemu_path except QemuError as e: + # If the binary is not found for topologies 1.4 and later + # search via the platform otherwise use the binary name if platform: self.platform = platform else: - raise e + self.qemu_path = os.path.basename(qemu_path) else: self.platform = platform diff --git a/tests/modules/qemu/test_qemu_vm.py b/tests/modules/qemu/test_qemu_vm.py index 103cbb14..1a36a62b 100644 --- a/tests/modules/qemu/test_qemu_vm.py +++ b/tests/modules/qemu/test_qemu_vm.py @@ -85,6 +85,22 @@ def test_vm(project, manager, fake_qemu_binary): assert vm.id == "00010203-0405-0607-0809-0a0b0c0d0e0f" +def test_vm_invalid_qemu_with_platform(project, manager, fake_qemu_binary): + + vm = QemuVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", project, manager, qemu_path="/usr/fake/bin/qemu-system-64", platform="x86_64") + + assert vm.qemu_path == fake_qemu_binary + assert vm.platform == "x86_64" + + +def test_vm_invalid_qemu_without_platform(project, manager, fake_qemu_binary): + + vm = QemuVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", project, manager, qemu_path="/usr/fake/bin/qemu-system-x86_64") + + assert vm.qemu_path == fake_qemu_binary + assert vm.platform == "x86_64" + + def test_is_running(vm, running_subprocess_mock): vm._process = None @@ -270,7 +286,6 @@ def test_set_qemu_path_old_windows(vm, tmpdir): assert vm.platform == "i386" - @pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows") def test_set_qemu_path_kvm_binary(vm, tmpdir, fake_qemu_binary):