mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 14:01:15 +02:00
API in order to get the list of IOU, Dynamips, Qemu images
This commit is contained in:
1 parent
5a4ffae6a2
commit
bca90bc563
14 files changed
+218
-36
No files matched your search
@@ -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
|
||||
|
||||
@@ -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.
|
||||
"""
|
||||
|
||||
Reference in new issue
Block a user