mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-25 16:28:11 +00:00
Fixes issue when loading a project using VMware vmnet interfaces. Fixes #319.
This commit is contained in:
parent
57bbd63085
commit
6e36687347
@ -348,9 +348,10 @@ class VMwareHandler:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@Route.post(
|
@Route.post(
|
||||||
r"/projects/{project_id}/vmware/interfaces/vmnet",
|
r"/projects/{project_id}/vmware/vms/{vm_id}/interfaces/vmnet",
|
||||||
parameters={
|
parameters={
|
||||||
"project_id": "The UUID of the project",
|
"project_id": "The UUID of the project",
|
||||||
|
"vm_id": "UUID for the instance",
|
||||||
},
|
},
|
||||||
status_codes={
|
status_codes={
|
||||||
201: "VMnet interface allocated",
|
201: "VMnet interface allocated",
|
||||||
@ -359,7 +360,9 @@ class VMwareHandler:
|
|||||||
def allocate_vmnet(request, response):
|
def allocate_vmnet(request, response):
|
||||||
|
|
||||||
vmware_manager = VMware.instance()
|
vmware_manager = VMware.instance()
|
||||||
|
vm = vmware_manager.get_vm(request.match_info["vm_id"], project_id=request.match_info["project_id"])
|
||||||
vmware_manager.refresh_vmnet_list(ubridge=False)
|
vmware_manager.refresh_vmnet_list(ubridge=False)
|
||||||
vmnet = vmware_manager.allocate_vmnet()
|
vmnet = vmware_manager.allocate_vmnet()
|
||||||
|
vm.vmnets.append(vmnet)
|
||||||
response.set_status(201)
|
response.set_status(201)
|
||||||
response.json({"vmnet": vmnet})
|
response.json({"vmnet": vmnet})
|
||||||
|
@ -820,6 +820,7 @@ class VMwareVM(BaseVM):
|
|||||||
raise VMwareError("Sorry, adding a link to a started VMware VM is not supported without uBridge enabled")
|
raise VMwareError("Sorry, adding a link to a started VMware VM is not supported without uBridge enabled")
|
||||||
self._vmx_pairs["ethernet{}.vnet".format(adapter_number)] = nio.vmnet
|
self._vmx_pairs["ethernet{}.vnet".format(adapter_number)] = nio.vmnet
|
||||||
self._write_vmx_file()
|
self._write_vmx_file()
|
||||||
|
if nio.vmnet not in self._vmnets:
|
||||||
self._vmnets.append(nio.vmnet)
|
self._vmnets.append(nio.vmnet)
|
||||||
adapter.add_nio(0, nio)
|
adapter.add_nio(0, nio)
|
||||||
if self._started and self._use_ubridge:
|
if self._started and self._use_ubridge:
|
||||||
|
Loading…
Reference in New Issue
Block a user