mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-13 20:08:55 +00:00
Merge branch '1.5' into 2.0
This commit is contained in:
commit
c0b09ae76a
@ -24,6 +24,7 @@ import asyncio
|
||||
import logging
|
||||
import aiohttp
|
||||
import json
|
||||
import sys
|
||||
from gns3server.utils import parse_version
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -623,7 +623,7 @@ class DockerVM(BaseNode):
|
||||
raise DockerError("Adapter {adapter_number} doesn't exist on Docker container '{name}'".format(name=self.name,
|
||||
adapter_number=adapter_number))
|
||||
|
||||
for index in range(128):
|
||||
for index in range(4096):
|
||||
if "veth-gns3-ext{}".format(index) not in psutil.net_if_addrs():
|
||||
adapter.ifc = "eth{}".format(str(index))
|
||||
adapter.host_ifc = "veth-gns3-ext{}".format(str(index))
|
||||
|
@ -529,7 +529,6 @@ class Project:
|
||||
"iou": "IOUDevice",
|
||||
"docker": "DockerVM"
|
||||
}
|
||||
|
||||
node_directory = os.path.join(self.path, "servers", "vm", "project-files")
|
||||
vm_server_use = False
|
||||
|
||||
@ -539,11 +538,11 @@ class Project:
|
||||
os.makedirs(node_directory, exist_ok=True)
|
||||
shutil.move(module_directory, os.path.join(node_directory, module))
|
||||
|
||||
# Patch node to use the GNS3 VM
|
||||
for node in topology["topology"]["nodes"]:
|
||||
if node["type"] == vm_type:
|
||||
node["server_id"] = 2
|
||||
vm_server_use = True
|
||||
# Patch node to use the GNS3 VM
|
||||
for node in topology["topology"]["nodes"]:
|
||||
if node["type"] == vm_type:
|
||||
node["server_id"] = 2
|
||||
vm_server_use = True
|
||||
|
||||
# We use the GNS3 VM. We need to add the server to the list
|
||||
if vm_server_use:
|
||||
|
@ -26,6 +26,9 @@ import datetime
|
||||
import sys
|
||||
import locale
|
||||
import argparse
|
||||
import psutil
|
||||
import asyncio
|
||||
|
||||
|
||||
from gns3server.web.web_server import WebServer
|
||||
from gns3server.web.logger import init_logger
|
||||
@ -180,6 +183,21 @@ def pid_lock(path):
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def kill_ghosts():
|
||||
"""
|
||||
Kill process from previous GNS3 session
|
||||
"""
|
||||
detect_process = ["vpcs", "ubridge", "dynamips"]
|
||||
for proc in psutil.process_iter():
|
||||
try:
|
||||
name = proc.name().lower().split(".")[0]
|
||||
if name in detect_process:
|
||||
proc.kill()
|
||||
log.warning("Killed ghost process %s", name)
|
||||
except (psutil.NoSuchProcess, psutil.AccessDenied):
|
||||
pass
|
||||
|
||||
|
||||
def run():
|
||||
args = parse_arguments(sys.argv[1:])
|
||||
|
||||
@ -189,6 +207,7 @@ def run():
|
||||
|
||||
if args.pid:
|
||||
pid_lock(args.pid)
|
||||
kill_ghosts()
|
||||
|
||||
level = logging.INFO
|
||||
if args.debug:
|
||||
|
@ -740,7 +740,7 @@ def test_add_ubridge_connection_no_free_interface(loop, vm):
|
||||
with pytest.raises(DockerError):
|
||||
|
||||
# We create fake ethernet interfaces for docker
|
||||
interfaces = ["veth-gns3-ext{}".format(index) for index in range(128)]
|
||||
interfaces = ["veth-gns3-ext{}".format(index) for index in range(4096)]
|
||||
|
||||
with patch("psutil.net_if_addrs", return_value=interfaces):
|
||||
loop.run_until_complete(asyncio.async(vm._add_ubridge_connection(nio, 0, 42)))
|
||||
|
Loading…
Reference in New Issue
Block a user