Support delete Qemu disk image from API

Return the real disk image name in the 'hdx_disk_image_backed' property for Qemu VMs
This commit is contained in:
grossmj committed 2022-04-14 17:01:54 +07:00
1 parent a1c76ec4f2
commit e50bed5bee
13 files changed
+191 -42

No files matched your search

+15
View File
@@ -348,6 +348,21 @@ async def update_disk_image(
return Response(status_code=status.HTTP_204_NO_CONTENT)
@router.delete("/{node_id}/qemu/disk_image/{disk_name}", status_code=status.HTTP_204_NO_CONTENT)
async def delete_disk_image(
disk_name: str,
node: Node = Depends(dep_node)
) -> Response:
"""
Delete a Qemu disk image.
"""
if node.node_type != "qemu":
raise ControllerBadRequestError("Deleting a disk image is only supported on a Qemu node")
await node.delete(f"/disk_image/{disk_name}")
return Response(status_code=status.HTTP_204_NO_CONTENT)
@router.get("/{node_id}/files/{file_path:path}")
async def get_file(file_path: str, node: Node = Depends(dep_node)) -> Response:
"""