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

+5 -2
View File
@@ -59,12 +59,15 @@ class ImagesRepository(BaseRepository):
result = await self._db_session.execute(query)
return result.scalars().first()
async def get_images(self) -> List[models.Image]:
async def get_images(self, image_type=None) -> List[models.Image]:
"""
Get all images.
"""
query = select(models.Image)
if image_type:
query = select(models.Image).where(models.Image.image_type == image_type)
else:
query = select(models.Image)
result = await self._db_session.execute(query)
return result.scalars().all()