Add the notion of adapters and slot in the api

This commit is contained in:
Julien Duponchelle committed 2015-02-13 18:09:50 +01:00
1 parent 821eb5e92b
commit 2cab5293c7
7 files changed
+39 -31

No files matched your search

+6 -4
View File
@@ -194,10 +194,11 @@ class IOUHandler:
response.set_status(204)
@Route.post(
r"/projects/{project_id}/iou/vms/{vm_id}/ports/{port_number:\d+}/nio",
r"/projects/{project_id}/iou/vms/{vm_id}/adapters/{adapter_number:\d+}/ports/{port_number:\d+}/nio",
parameters={
"project_id": "UUID for the project",
"vm_id": "UUID for the instance",
"adapter_number": "Network adapter where the nio is located",
"port_number": "Port where the nio should be added"
},
status_codes={
@@ -213,16 +214,17 @@ class IOUHandler:
iou_manager = IOU.instance()
vm = iou_manager.get_vm(request.match_info["vm_id"], project_id=request.match_info["project_id"])
nio = iou_manager.create_nio(vm.iouyap_path, request.json)
vm.slot_add_nio_binding(0, int(request.match_info["port_number"]), nio)
vm.slot_add_nio_binding(int(request.match_info["adapter_number"]), int(request.match_info["port_number"]), nio)
response.set_status(201)
response.json(nio)
@classmethod
@Route.delete(
r"/projects/{project_id}/iou/vms/{vm_id}/ports/{port_number:\d+}/nio",
r"/projects/{project_id}/iou/vms/{vm_id}/adapters/{adapter_number:\d+}/ports/{port_number:\d+}/nio",
parameters={
"project_id": "UUID for the project",
"vm_id": "UUID for the instance",
"adapter_number": "Network adapter where the nio is located",
"port_number": "Port from where the nio should be removed"
},
status_codes={
@@ -235,5 +237,5 @@ class IOUHandler:
iou_manager = IOU.instance()
vm = iou_manager.get_vm(request.match_info["vm_id"], project_id=request.match_info["project_id"])
vm.slot_remove_nio_binding(0, int(request.match_info["port_number"]))
vm.slot_remove_nio_binding(int(request.match_info["adapter_number"]), int(request.match_info["port_number"]))
response.set_status(204)
+6 -4
View File
@@ -252,11 +252,12 @@ class VirtualBoxHandler:
response.set_status(204)
@Route.post(
r"/projects/{project_id}/virtualbox/vms/{vm_id}/adapters/{adapter_id:\d+}/nio",
r"/projects/{project_id}/virtualbox/vms/{vm_id}/adapters/{adapter_id:\d+}/ports/{port_id:\d+}/nio",
parameters={
"project_id": "UUID for the project",
"vm_id": "UUID for the instance",
"adapter_id": "Adapter where the nio should be added"
"adapter_id": "Adapter where the nio should be added",
"port_id": "Port in the adapter (always 0 for virtualbox)"
},
status_codes={
201: "NIO created",
@@ -277,11 +278,12 @@ class VirtualBoxHandler:
@classmethod
@Route.delete(
r"/projects/{project_id}/virtualbox/vms/{vm_id}/adapters/{adapter_id:\d+}/nio",
r"/projects/{project_id}/virtualbox/vms/{vm_id}/adapters/{adapter_id:\d+}/ports/{port_id:\d+}/nio",
parameters={
"project_id": "UUID for the project",
"vm_id": "UUID for the instance",
"adapter_id": "Adapter from where the nio should be removed"
"adapter_id": "Adapter from where the nio should be removed",
"port_id": "Port in the adapter (always 0 for virtualbox)"
},
status_codes={
204: "NIO deleted",
+4 -2
View File
@@ -178,10 +178,11 @@ class VPCSHandler:
response.set_status(204)
@Route.post(
r"/projects/{project_id}/vpcs/vms/{vm_id}/ports/{port_number:\d+}/nio",
r"/projects/{project_id}/vpcs/vms/{vm_id}/adapters/{adapter_number:\d+}/ports/{port_number:\d+}/nio",
parameters={
"project_id": "UUID for the project",
"vm_id": "UUID for the instance",
"adapter_number": "Network adapter where the nio is located",
"port_number": "Port where the nio should be added"
},
status_codes={
@@ -203,10 +204,11 @@ class VPCSHandler:
@classmethod
@Route.delete(
r"/projects/{project_id}/vpcs/vms/{vm_id}/ports/{port_number:\d+}/nio",
r"/projects/{project_id}/vpcs/vms/{vm_id}/adapters/{adapter_number:\d+}/ports/{port_number:\d+}/nio",
parameters={
"project_id": "UUID for the project",
"vm_id": "UUID for the instance",
"adapter_number": "Network adapter where the nio is located",
"port_number": "Port from where the nio should be removed"
},
status_codes={