mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 14:01:15 +02:00
Merge branch '1.5' into networkv2
This commit is contained in:
10 files changed
+85
-44
No files matched your search
@@ -195,16 +195,22 @@ class DockerVM(BaseVM):
|
||||
},
|
||||
"Volumes": {},
|
||||
"Env": [],
|
||||
"Cmd": image_infos.get("ContainerConfig", {"Cmd": []})["Cmd"]
|
||||
"Cmd": [],
|
||||
"Entrypoint": image_infos.get("Config", {"Entrypoint": []})["Entrypoint"]
|
||||
}
|
||||
|
||||
params["Cmd"].insert(0, "/bin/sh")
|
||||
params["Cmd"].insert(1, "/gns3/init.sh")
|
||||
|
||||
if params["Entrypoint"] is None:
|
||||
params["Entrypoint"] = []
|
||||
if self._start_command:
|
||||
params["Cmd"] += shlex.split(self._start_command)
|
||||
else:
|
||||
if len(params["Cmd"]) == 2:
|
||||
params["Cmd"] += ["/bin/sh"]
|
||||
params["Cmd"] = shlex.split(self._start_command)
|
||||
if len(params["Cmd"]) == 0:
|
||||
params["Cmd"] = image_infos.get("Config", {"Cmd": []})["Cmd"]
|
||||
if params["Cmd"] is None:
|
||||
params["Cmd"] = []
|
||||
if len(params["Cmd"]) == 0 and len(params["Entrypoint"]) == 0:
|
||||
params["Cmd"] = ["/bin/sh"]
|
||||
params["Entrypoint"].insert(0, "/gns3/init.sh")
|
||||
|
||||
if self._environment:
|
||||
params["Env"] += [e.strip() for e in self._environment.split("\n")]
|
||||
|
||||
Regular → Executable
+1
-1
@@ -43,4 +43,4 @@ sed -n 's/^ *\(eth[0-9]*\):.*/\1/p' < /proc/net/dev | while read dev; do
|
||||
done
|
||||
|
||||
# continue normal docker startup
|
||||
/bin/sh -c "$@"
|
||||
exec "$@"
|
||||
@@ -55,7 +55,6 @@ class DynamipsHypervisor:
|
||||
self._working_dir = working_dir
|
||||
self._version = "N/A"
|
||||
self._timeout = timeout
|
||||
self._uuid = None
|
||||
self._reader = None
|
||||
self._writer = None
|
||||
self._io_lock = asyncio.Lock()
|
||||
@@ -99,8 +98,6 @@ class DynamipsHypervisor:
|
||||
except IndexError:
|
||||
self._version = "Unknown"
|
||||
|
||||
self._uuid = yield from self.send("hypervisor uuid")
|
||||
|
||||
# this forces to send the working dir to Dynamips
|
||||
yield from self.set_working_dir(self._working_dir)
|
||||
|
||||
@@ -174,16 +171,6 @@ class DynamipsHypervisor:
|
||||
|
||||
return self._working_dir
|
||||
|
||||
@property
|
||||
def uuid(self):
|
||||
"""
|
||||
Returns this hypervisor UUID.
|
||||
|
||||
:Returns: uuid string
|
||||
"""
|
||||
|
||||
return self._uuid
|
||||
|
||||
@property
|
||||
def devices(self):
|
||||
"""
|
||||
|
||||
@@ -35,10 +35,10 @@ from pkg_resources import parse_version
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
from ..base_manager import BaseManager
|
||||
from .vmware_vm import VMwareVM
|
||||
from .vmware_error import VMwareError
|
||||
from .nio_vmnet import NIOVMNET
|
||||
from gns3server.modules.base_manager import BaseManager
|
||||
from gns3server.modules.vmware.vmware_vm import VMwareVM
|
||||
from gns3server.modules.vmware.vmware_error import VMwareError
|
||||
from gns3server.modules.vmware.nio_vmnet import NIOVMNET
|
||||
|
||||
|
||||
class VMware(BaseManager):
|
||||
@@ -162,8 +162,8 @@ class VMware(BaseManager):
|
||||
else:
|
||||
if sys.platform.startswith("darwin"):
|
||||
if not os.path.isdir("/Applications/VMware Fusion.app"):
|
||||
raise VMwareError("VMware Fusion is not installed")
|
||||
return # FIXME: no version checking on Mac OS X
|
||||
raise VMwareError("VMware Fusion is not installed in the standard location /Applications/VMware Fusion.app")
|
||||
return # FIXME: no version checking on Mac OS X but we support all versions of fusion
|
||||
|
||||
vmware_path = VMware._get_linux_vmware_binary()
|
||||
if vmware_path is None:
|
||||
@@ -646,3 +646,10 @@ class VMware(BaseManager):
|
||||
if path is None:
|
||||
path = shutil.which("vmplayer")
|
||||
return path
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
loop = asyncio.get_event_loop()
|
||||
vmware = VMware.instance()
|
||||
print("=> Check version")
|
||||
loop.run_until_complete(asyncio.async(vmware.check_vmware_version()))
|
||||
@@ -26,7 +26,7 @@ import asyncio
|
||||
import tempfile
|
||||
|
||||
from gns3server.utils.telnet_server import TelnetServer
|
||||
from gns3server.utils.interfaces import get_windows_interfaces
|
||||
from gns3server.utils.interfaces import interfaces, get_windows_interfaces
|
||||
from gns3server.utils.asyncio import wait_for_file_creation, wait_for_named_pipe_creation
|
||||
from collections import OrderedDict
|
||||
from .vmware_error import VMwareError
|
||||
@@ -318,20 +318,29 @@ class VMwareVM(BaseVM):
|
||||
vmnet_interface = os.path.basename(self._vmx_pairs[vnet])
|
||||
if sys.platform.startswith("linux"):
|
||||
yield from self._ubridge_hypervisor.send('bridge add_nio_linux_raw {name} "{interface}"'.format(name=vnet,
|
||||
interface=vmnet_interface))
|
||||
interface=vmnet_interface))
|
||||
elif sys.platform.startswith("win"):
|
||||
windows_interfaces = get_windows_interfaces()
|
||||
npf = None
|
||||
source_mac = None
|
||||
for interface in windows_interfaces:
|
||||
if "netcard" in interface and vmnet_interface in interface["netcard"]:
|
||||
npf = interface["id"]
|
||||
source_mac = interface["mac_address"]
|
||||
elif vmnet_interface in interface["name"]:
|
||||
npf = interface["id"]
|
||||
source_mac = interface["mac_address"]
|
||||
if npf:
|
||||
yield from self._ubridge_hypervisor.send('bridge add_nio_ethernet {name} "{interface}"'.format(name=vnet,
|
||||
interface=npf))
|
||||
else:
|
||||
raise VMwareError("Could not find NPF id for VMnet interface {}".format(vmnet_interface))
|
||||
|
||||
# TODO: should provide that as an option
|
||||
#if source_mac:
|
||||
# yield from self._ubridge_hypervisor.send('bridge set_pcap_filter {name} "not ether src {mac}"'.format(name=vnet,
|
||||
# mac=source_mac))
|
||||
|
||||
elif sys.platform.startswith("darwin"):
|
||||
yield from self._ubridge_hypervisor.send('bridge add_nio_fusion_vmnet {name} "{interface}"'.format(name=vnet,
|
||||
interface=vmnet_interface))
|
||||
@@ -351,6 +360,14 @@ class VMwareVM(BaseVM):
|
||||
|
||||
yield from self._ubridge_hypervisor.send('bridge start {name}'.format(name=vnet))
|
||||
|
||||
# TODO: this only work when using PCAP (NIO Ethernet)
|
||||
# source_mac = None
|
||||
# for interface in interfaces():
|
||||
# if interface["name"] == vmnet_interface:
|
||||
# source_mac = interface["mac_address"]
|
||||
# if source_mac:
|
||||
# yield from self._ubridge_hypervisor.send('bridge set_pcap_filter {name} "not ether src {mac}"'.format(name=vnet, mac=source_mac))
|
||||
|
||||
@asyncio.coroutine
|
||||
def _delete_ubridge_connection(self, adapter_number):
|
||||
"""
|
||||
|
||||
Reference in new issue
Block a user