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

This commit is contained in:
Julien Duponchelle committed 2015-04-16 18:32:12 +02:00
1 parent 5a4ffae6a2
commit bca90bc563
14 files changed
+218 -36

No files matched your search

+19
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
+1 -1
View File
@@ -117,7 +117,7 @@ class VirtualBox(BaseManager):
return stdout_data.decode("utf-8", errors="ignore").splitlines()
@asyncio.coroutine
def get_list(self):
def list_images(self):
"""
Gets VirtualBox VM list.
"""