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

@ -25,6 +25,7 @@ from ...schemas.dynamips_vm import VM_CAPTURE_SCHEMA
from ...schemas.dynamips_vm import VM_OBJECT_SCHEMA
from ...schemas.dynamips_vm import VM_NIO_SCHEMA
from ...schemas.dynamips_vm import VM_CONFIGS_SCHEMA
from ...schemas.dynamips_vm import VMS_LIST_SCHEMA
from ...modules.dynamips import Dynamips
from ...modules.project_manager import ProjectManager
@ -421,3 +422,17 @@ class DynamipsVMHandler:
idlepc = yield from dynamips_manager.auto_idlepc(vm)
response.set_status(200)
response.json({"idlepc": idlepc})
@Route.get(
r"/dynamips/vms",
status_codes={
200: "List of Dynamips VM retrieved",
},
description="Retrieve the list of Dynamips VMS",
output=VMS_LIST_SCHEMA)
def list_vms(request, response):
dynamips_manager = Dynamips.instance()
vms = yield from dynamips_manager.list_images()
response.set_status(200)
response.json(vms)