mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-06-18 15:28:11 +00:00
API in order to get the list of IOU, Dynamips, Qemu images
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user