diff --git a/gns3server/modules/qemu/qemu_vm.py b/gns3server/modules/qemu/qemu_vm.py index 54e54297..561e521c 100644 --- a/gns3server/modules/qemu/qemu_vm.py +++ b/gns3server/modules/qemu/qemu_vm.py @@ -1004,7 +1004,6 @@ class QemuVM(BaseVM): @asyncio.coroutine def _disk_options(self): - options = [] qemu_img_path = "" qemu_path_dir = os.path.dirname(self.qemu_path) diff --git a/tests/modules/qemu/test_qemu_vm.py b/tests/modules/qemu/test_qemu_vm.py index 246a3d8c..70b22c8d 100644 --- a/tests/modules/qemu/test_qemu_vm.py +++ b/tests/modules/qemu/test_qemu_vm.py @@ -269,13 +269,16 @@ def test_set_platform(project, manager): assert vm.qemu_path == "/bin/qemu-system-x86_64" -def test_disk_options(vm, loop, fake_qemu_img_binary): +def test_disk_options(vm, tmpdir, loop, fake_qemu_img_binary): + + vm._hda_disk_image = str(tmpdir / "test.qcow2") + open(vm._hda_disk_image, "w+").close() with asyncio_patch("asyncio.create_subprocess_exec", return_value=MagicMock()) as process: loop.run_until_complete(asyncio.async(vm._disk_options())) assert process.called args, kwargs = process.call_args - assert args == (fake_qemu_img_binary, "create", "-f", "qcow2", os.path.join(vm.working_dir, "flash.qcow2"), "256M") + assert args == (fake_qemu_img_binary, "create", "-o", "backing_file={}".format(vm._hda_disk_image), "-f", "qcow2", os.path.join(vm.working_dir, "hda_disk.qcow2")) @pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows") @@ -337,8 +340,6 @@ def test_build_command(vm, loop, fake_qemu_binary, port_manager): "test", "-m", "256", - "-hda", - os.path.join(vm.working_dir, "flash.qcow2"), "-serial", "telnet:127.0.0.1:{},server,nowait".format(vm.console), "-net",