Merge pull request #1801 from GNS3/qemu-config-disk

QEMU config disk - enable QEMU config import/export
This commit is contained in:
Jeremy Grossmann authored and GitHub committed 2020-08-15 16:35:20 +08:00
commit fa26555d00
11 files changed
+284 -35

No files matched your search

+1
View File
@@ -337,6 +337,7 @@ def test_set_qemu_path_kvm_binary(vm, fake_qemu_binary):
async def test_set_platform(compute_project, manager):
manager.config_disk = None # avoids conflict with config.img support
with patch("shutil.which", return_value="/bin/qemu-system-x86_64") as which_mock:
with patch("gns3server.compute.qemu.QemuVM._check_qemu_path"):
vm = QemuVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", compute_project, manager, platform="x86_64")
+2 -1
View File
@@ -18,7 +18,7 @@
import uuid
import os
import pytest
from unittest.mock import patch
from unittest.mock import patch, MagicMock
from tests.utils import asyncio_patch
from gns3server.compute.vpcs import VPCS
@@ -41,6 +41,7 @@ async def vpcs(loop, port_manager):
async def qemu(loop, port_manager):
Qemu._instance = None
Qemu._init_config_disk = MagicMock() # do not create the config.img image
qemu = Qemu.instance()
qemu.port_manager = port_manager
return qemu
+2 -2
View File
@@ -117,8 +117,8 @@ def images_dir(config):
path = config.get_section_config("Server").get("images_path")
os.makedirs(path, exist_ok=True)
os.makedirs(os.path.join(path, "QEMU"))
os.makedirs(os.path.join(path, "IOU"))
os.makedirs(os.path.join(path, "QEMU"), exist_ok=True)
os.makedirs(os.path.join(path, "IOU"), exist_ok=True)
return path
+2 -1
View File
@@ -277,7 +277,8 @@ async def test_images(compute_api, fake_qemu_vm):
response = await compute_api.get("/qemu/images")
assert response.status == 200
assert response.json == [{"filename": "linux载.img", "path": "linux载.img", "md5sum": "c4ca4238a0b923820dcc509a6f75849b", "filesize": 1}]
assert response.json == [{'filename': 'config.img', 'filesize': 1048576, 'md5sum': '0ab49056760ae1db6c25376446190b47', 'path': 'config.img'},
{"filename": "linux载.img", "path": "linux载.img", "md5sum": "c4ca4238a0b923820dcc509a6f75849b", "filesize": 1}]
async def test_upload_image(compute_api, tmpdir):
@@ -669,13 +669,13 @@ async def test_qemu_template_create(controller_api):
"default_name_format": "{name}-{0}",
"first_port_name": "",
"hda_disk_image": "IOSvL2-15.2.4.0.55E.qcow2",
"hda_disk_interface": "ide",
"hda_disk_interface": "none",
"hdb_disk_image": "",
"hdb_disk_interface": "ide",
"hdb_disk_interface": "none",
"hdc_disk_image": "",
"hdc_disk_interface": "ide",
"hdc_disk_interface": "none",
"hdd_disk_image": "",
"hdd_disk_interface": "ide",
"hdd_disk_interface": "none",
"initrd": "",
"kernel_command_line": "",
"kernel_image": "",