Allows VMware VMs to use vmnet interfaces for connections without using uBridge. Fixes #295.

This commit is contained in:
grossmj committed 2015-09-05 14:38:11 -06:00
1 parent 476e033a78
commit 4efec03448
6 files changed
+262 -83

No files matched your search

+19 -1
View File
@@ -268,7 +268,7 @@ class VMwareHandler:
vmware_manager = VMware.instance()
vm = vmware_manager.get_vm(request.match_info["vm_id"], project_id=request.match_info["project_id"])
nio_type = request.json["type"]
if nio_type != "nio_udp":
if nio_type not in ("nio_udp", "nio_vmnet"):
raise HTTPConflict(text="NIO of type {} is not supported".format(nio_type))
nio = vmware_manager.create_nio(None, request.json)
yield from vm.adapter_add_nio_binding(int(request.match_info["adapter_number"]), nio)
@@ -296,3 +296,21 @@ class VMwareHandler:
vm = vmware_manager.get_vm(request.match_info["vm_id"], project_id=request.match_info["project_id"])
yield from vm.adapter_remove_nio_binding(int(request.match_info["adapter_number"]))
response.set_status(204)
@classmethod
@Route.post(
r"/projects/{project_id}/vmware/interfaces/vmnet",
parameters={
"project_id": "The UUID of the project",
},
status_codes={
201: "VMnet interface allocated",
},
description="Allocate a VMware VMnet interface on the server")
def allocate_vmnet(request, response):
vmware_manager = VMware.instance()
vmware_manager.refresh_vmnet_list()
vmnet = vmware_manager.allocate_vmnet()
response.set_status(201)
response.json({"vmnet": vmnet})