Merge pull request #2055 from GNS3/remove-qemu-binaries-requirement

Remove Qemu binary requirement
This commit is contained in:
Jeremy Grossmann authored and GitHub committed 2022-06-06 14:51:07 +08:00
commit 3b7dfe5929
6 files changed
+27 -95

No files matched your search

-14
View File
@@ -121,20 +121,6 @@ def compute_statistics() -> dict:
}
@router.get("/qemu/binaries")
async def get_qemu_binaries(
archs: Optional[List[str]] = Body(None, embed=True)
) -> List[str]:
return await Qemu.binary_list(archs)
@router.get("/qemu/img-binaries")
async def get_image_binaries() -> List[str]:
return await Qemu.img_binary_list()
@router.get("/qemu/capabilities")
async def get_qemu_capabilities() -> dict:
capabilities = {"kvm": []}
+2 -2
View File
@@ -160,8 +160,8 @@ async def forward_put(compute_id: Union[str, UUID], emulator: str, endpoint_path
return await compute.forward("PUT", emulator, endpoint_path, data=compute_data)
@router.post("/{compute_id}/auto_idlepc")
async def autoidlepc(compute_id: Union[str, UUID], auto_idle_pc: schemas.AutoIdlePC) -> str:
@router.post("/{compute_id}/dynamips/auto_idlepc")
async def dynamips_autoidlepc(compute_id: Union[str, UUID], auto_idle_pc: schemas.AutoIdlePC) -> str:
"""
Find a suitable Idle-PC value for a given IOS image. This may take a few minutes.
"""
-24
View File
@@ -159,30 +159,6 @@ class Qemu(BaseManager):
return qemus
@staticmethod
async def img_binary_list():
"""
Gets QEMU-img binaries list available on the host.
:returns: Array of dictionary {"path": Qemu-img binary path, "version": version of Qemu-img}
"""
qemu_imgs = []
for path in Qemu.paths_list():
try:
for f in os.listdir(path):
if (
(f == "qemu-img" or f == "qemu-img.exe")
and os.access(os.path.join(path, f), os.X_OK)
and os.path.isfile(os.path.join(path, f))
):
qemu_path = os.path.join(path, f)
version = await Qemu._get_qemu_img_version(qemu_path)
qemu_imgs.append({"path": qemu_path, "version": version})
except OSError:
continue
return qemu_imgs
@staticmethod
async def get_qemu_version(qemu_path):
"""
@@ -95,10 +95,8 @@ class ApplianceToTemplate:
new_config["options"] = options.strip()
new_config.update(version.get("images"))
if "path" in appliance_config["qemu"]:
new_config["qemu_path"] = appliance_config["qemu"]["path"]
else:
new_config["qemu_path"] = "qemu-system-{}".format(appliance_config["qemu"]["arch"])
if "arch" in appliance_config["qemu"]:
new_config["platform"] = appliance_config["qemu"]["arch"]
if "first_port_name" in appliance_config:
new_config["first_port_name"] = appliance_config["first_port_name"]