Save image size + start to automatic template creation based on image checksum.

This commit is contained in:
grossmj
2021-08-11 16:58:23 +09:30
parent f13b4e89b7
commit 078c42f185
7 changed files with 39 additions and 9 deletions

View File

@ -56,8 +56,8 @@ async def get_images(
@router.post("/upload/{image_name}", response_model=schemas.Image, status_code=status.HTTP_201_CREATED)
async def upload_image(
image_name: str,
image_type: schemas.ImageType,
request: Request,
image_type: schemas.ImageType = schemas.ImageType.qemu,
images_repo: ImagesRepository = Depends(get_repository(ImagesRepository)),
) -> schemas.Image:
"""
@ -78,6 +78,11 @@ async def upload_image(
except (OSError, InvalidImageError) as e:
raise ControllerError(f"Could not save {image_type} image '{image_name}': {e}")
# TODO: automatically create template based on image checksum
#from gns3server.controller import Controller
#controller = Controller.instance()
#controller.appliance_manager.find_appliance_with_image(image.checksum)
return image