mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-13 20:08:55 +00:00
Do not use VMnet0 when allocating VMnet adapters.
This commit is contained in:
parent
dd9c18b9f8
commit
1fea086f13
@ -253,7 +253,7 @@ class VMware(BaseManager):
|
||||
if winreg.QueryInfoKey(hkeyvmnet)[1]:
|
||||
# the vmnet has not been configure if the key has no values
|
||||
vmnet = vmnet.replace("vm", "VM")
|
||||
if vmnet not in ("VMnet1", "VMnet8"):
|
||||
if vmnet not in ("VMnet0", "VMnet1", "VMnet8"):
|
||||
vmnet_interfaces.append(vmnet)
|
||||
winreg.CloseKey(hkeyvmnet)
|
||||
winreg.CloseKey(hkey)
|
||||
@ -278,7 +278,7 @@ class VMware(BaseManager):
|
||||
match = re.search("VNET_([0-9]+)_VIRTUAL_ADAPTER", line)
|
||||
if match:
|
||||
vmnet = "vmnet{}".format(match.group(1))
|
||||
if vmnet not in ("vmnet1", "vmnet8"):
|
||||
if vmnet not in ("vmnet0", "vmnet1", "vmnet8"):
|
||||
vmnet_interfaces.append(vmnet)
|
||||
except OSError as e:
|
||||
raise VMwareError("Cannot open {}: {}".format(vmware_networking_file, e))
|
||||
@ -297,11 +297,11 @@ class VMware(BaseManager):
|
||||
match = re.search("(VMnet[0-9]+)", windows_name)
|
||||
if match:
|
||||
vmnet = match.group(1)
|
||||
if vmnet not in ("VMnet1", "VMnet8"):
|
||||
if vmnet not in ("VMnet0", "VMnet1", "VMnet8"):
|
||||
vmnet_interfaces.append(vmnet)
|
||||
elif interface["name"].startswith("vmnet"):
|
||||
vmnet = interface["name"]
|
||||
if vmnet not in ("vmnet1", "vmnet8"):
|
||||
if vmnet not in ("vmnet0", "vmnet1", "vmnet8"):
|
||||
vmnet_interfaces.append(interface["name"])
|
||||
return vmnet_interfaces
|
||||
|
||||
|
@ -24,7 +24,6 @@ import os
|
||||
import asyncio
|
||||
import tempfile
|
||||
|
||||
from gns3server.utils.interfaces import interfaces
|
||||
from gns3server.utils.asyncio.telnet_server import AsyncioTelnetServer
|
||||
from gns3server.utils.asyncio.serial import asyncio_open_serial
|
||||
from gns3server.utils.asyncio import locked_coroutine
|
||||
@ -277,6 +276,7 @@ class VMwareVM(BaseNode):
|
||||
continue
|
||||
|
||||
self._vmx_pairs["ethernet{}.connectiontype".format(adapter_number)] = "custom"
|
||||
|
||||
# make sure we have a vmnet per adapter if we use uBridge
|
||||
allocate_vmnet = False
|
||||
|
||||
@ -285,7 +285,7 @@ class VMwareVM(BaseNode):
|
||||
if vnet in self._vmx_pairs:
|
||||
vmnet = os.path.basename(self._vmx_pairs[vnet])
|
||||
if self.manager.is_managed_vmnet(vmnet) or vmnet in ("vmnet0", "vmnet1", "vmnet8"):
|
||||
# vmnet already managed, try to allocate a new one
|
||||
# vmnet already managed or a special vmnet, try to allocate a new one
|
||||
allocate_vmnet = True
|
||||
else:
|
||||
# otherwise allocate a new one
|
||||
@ -299,7 +299,7 @@ class VMwareVM(BaseNode):
|
||||
self._vmnets.clear()
|
||||
raise
|
||||
|
||||
# mark the vmnet managed by us
|
||||
# mark the vmnet as managed by us
|
||||
if vmnet not in self._vmnets:
|
||||
self._vmnets.append(vmnet)
|
||||
self._vmx_pairs["ethernet{}.vnet".format(adapter_number)] = vmnet
|
||||
@ -739,17 +739,18 @@ class VMwareVM(BaseNode):
|
||||
if self._get_vmx_setting("ethernet{}.present".format(adapter_number), "TRUE"):
|
||||
# check for the connection type
|
||||
connection_type = "ethernet{}.connectiontype".format(adapter_number)
|
||||
if connection_type in self._vmx_pairs and self._vmx_pairs[connection_type] in ("nat", "bridged", "hostonly"):
|
||||
if not self._use_any_adapter:
|
||||
raise VMwareError("Attachment '{attachment}' is already configured on network adapter {adapter_number}. "
|
||||
"Please remove it or allow VMware VM '{name}' to use any adapter.".format(attachment=self._vmx_pairs[connection_type],
|
||||
adapter_number=adapter_number,
|
||||
name=self.name))
|
||||
elif (yield from self.is_running()):
|
||||
if not self._use_any_adapter and connection_type in self._vmx_pairs and self._vmx_pairs[connection_type] in ("nat", "bridged", "hostonly"):
|
||||
if (yield from self.is_running()):
|
||||
raise VMwareError("Attachment '{attachment}' is configured on network adapter {adapter_number}. "
|
||||
"Please stop VMware VM '{name}' to link to this adapter and allow GNS3 to change the attachment type.".format(attachment=self._vmx_pairs[connection_type],
|
||||
adapter_number=adapter_number,
|
||||
name=self.name))
|
||||
else:
|
||||
raise VMwareError("Attachment '{attachment}' is already configured on network adapter {adapter_number}. "
|
||||
"Please remove it or allow VMware VM '{name}' to use any adapter.".format(attachment=self._vmx_pairs[connection_type],
|
||||
adapter_number=adapter_number,
|
||||
name=self.name))
|
||||
|
||||
|
||||
adapter.add_nio(0, nio)
|
||||
if self._started and self._ubridge_hypervisor:
|
||||
|
Loading…
Reference in New Issue
Block a user