mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 14:01:15 +02:00
Merge branch '2.2' into 3.0
# Conflicts: # gns3server/compute/qemu/qemu_vm.py # gns3server/handlers/api/compute/server_handler.py # gns3server/utils/path.py # gns3server/version.py # requirements.txt # tests/compute/qemu/test_qemu_vm.py # tests/compute/test_manager.py
This commit is contained in:
commit
a324459152
571 files changed
+3964
-13577
No files matched your search
@@ -74,5 +74,5 @@ async def test_rebase(tmpdir):
|
||||
qcow2 = Qcow2(str(tmpdir / "linked.qcow2"))
|
||||
assert qcow2.version == 3
|
||||
assert qcow2.backing_file == "empty8G.qcow2"
|
||||
await qcow2.rebase(qemu_img(), str(tmpdir / "empty16G.qcow2"))
|
||||
await qcow2.rebase(qemu_img(), str(tmpdir / "empty16G.qcow2"), "qcow2")
|
||||
assert qcow2.backing_file == str(tmpdir / "empty16G.qcow2")
|
||||
@@ -372,11 +372,12 @@ async def test_disk_options(vm, tmpdir, 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:
|
||||
options = await vm._disk_options()
|
||||
assert process.called
|
||||
args, kwargs = process.call_args
|
||||
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"))
|
||||
with asyncio_patch("gns3server.compute.qemu.qemu_vm.QemuVM._find_disk_file_format", return_value="qcow2"):
|
||||
with asyncio_patch("asyncio.create_subprocess_exec", return_value=MagicMock()) as process:
|
||||
options = await vm._disk_options()
|
||||
assert process.called
|
||||
args, kwargs = process.call_args
|
||||
assert args == (fake_qemu_img_binary, "create", "-o", "backing_file={}".format(vm._hda_disk_image), "-F", "qcow2", "-f", "qcow2", os.path.join(vm.working_dir, "hda_disk.qcow2"))
|
||||
|
||||
assert options == ['-drive', 'file=' + os.path.join(vm.working_dir, "hda_disk.qcow2") + ',if=ide,index=0,media=disk,id=drive0']
|
||||
|
||||
@@ -434,8 +435,9 @@ async def test_disk_options_multiple_disk(vm, tmpdir, fake_qemu_img_binary):
|
||||
open(vm._hdc_disk_image, "w+").close()
|
||||
open(vm._hdd_disk_image, "w+").close()
|
||||
|
||||
with asyncio_patch("asyncio.create_subprocess_exec", return_value=MagicMock()):
|
||||
options = await vm._disk_options()
|
||||
with asyncio_patch("gns3server.compute.qemu.qemu_vm.QemuVM._find_disk_file_format", return_value="qcow2"):
|
||||
with asyncio_patch("asyncio.create_subprocess_exec", return_value=MagicMock()):
|
||||
options = await vm._disk_options()
|
||||
|
||||
assert options == [
|
||||
'-drive', 'file=' + os.path.join(vm.working_dir, "hda_disk.qcow2") + ',if=ide,index=0,media=disk,id=drive0',
|
||||
@@ -912,8 +914,8 @@ async def test_run_with_kvm_linux(linux_platform, vm):
|
||||
async def test_run_with_kvm_linux_options_no_kvm(linux_platform, vm):
|
||||
|
||||
with 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", "-machine accel=tcg") is False
|
||||
vm.manager.config.set("Qemu", "enable_kvm", True)
|
||||
assert await vm._run_with_hardware_acceleration("qemu-system-x86_64", "-no-kvm") is False
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
Reference in new issue
Block a user