API in order to get the list of IOU, Dynamips, Qemu images

This commit is contained in:
Julien Duponchelle
2015-04-13 14:33:13 +02:00
parent 5a4ffae6a2
commit bca90bc563
14 changed files with 218 additions and 36 deletions

View File

@ -403,6 +403,25 @@ class BaseManager:
return os.path.basename(path)
return path
@asyncio.coroutine
def list_images(self):
"""
Return the list of available images for this VM type
:returns: Array of hash
"""
try:
files = os.listdir(self.get_images_directory())
except FileNotFoundError:
return []
files.sort()
images = []
for filename in files:
if filename[0] != ".":
images.append({"filename": filename})
return images
def get_images_directory(self):
"""
Get the image directory on disk