mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Expose /virtualbox/vms /vmwares/vms and /images via controller
Ref #1192, #537
This commit is contained in:
4 files changed
+88
-2
No files matched your search
@@ -322,3 +322,11 @@ class Compute:
|
||||
@asyncio.coroutine
|
||||
def delete(self, path, **kwargs):
|
||||
return (yield from self.http_query("DELETE", path, **kwargs))
|
||||
|
||||
@asyncio.coroutine
|
||||
def forward(self, type, path):
|
||||
"""
|
||||
Forward a call to the emulator on compute
|
||||
"""
|
||||
res = yield from self.get("/{}/{}".format(type, path))
|
||||
return res
|
||||
@@ -77,6 +77,38 @@ class ComputeHandler:
|
||||
response.set_status(200)
|
||||
response.json(compute)
|
||||
|
||||
@Route.get(
|
||||
r"/computes/{compute_id:.+}/{emulator}/images",
|
||||
parameters={
|
||||
"compute_id": "Compute UUID"
|
||||
},
|
||||
status_codes={
|
||||
200: "OK",
|
||||
404: "Instance doesn't exist"
|
||||
},
|
||||
description="Get the list of images available on remote compute")
|
||||
def list_images(request, response):
|
||||
controller = Controller.instance()
|
||||
compute = controller.get_compute(request.match_info["compute_id"])
|
||||
images = yield from compute.forward(request.match_info["emulator"], "images")
|
||||
response.json(images)
|
||||
|
||||
@Route.get(
|
||||
r"/computes/{compute_id:.+}/{emulator}/vms",
|
||||
parameters={
|
||||
"compute_id": "Compute UUID"
|
||||
},
|
||||
status_codes={
|
||||
200: "OK",
|
||||
404: "Instance doesn't exist"
|
||||
},
|
||||
description="Get the list of vms available on remote compute for VMware an Virtualbox")
|
||||
def list_vms(request, response):
|
||||
controller = Controller.instance()
|
||||
compute = controller.get_compute(request.match_info["compute_id"])
|
||||
images = yield from compute.forward(request.match_info["emulator"], "vms")
|
||||
response.json(images)
|
||||
|
||||
@Route.get(
|
||||
r"/computes/{compute_id:.+}",
|
||||
description="Get a compute server information",
|
||||
@@ -93,7 +125,6 @@ class ComputeHandler:
|
||||
@Route.delete(
|
||||
r"/computes/{compute_id:.+}",
|
||||
parameters={
|
||||
"project_id": "Project UUID",
|
||||
"compute_id": "Compute UUID"
|
||||
},
|
||||
status_codes={
|
||||
|
||||
Reference in new issue
Block a user