1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-26 16:58:28 +00:00

Merge branch '2.2' into 3.0

# Conflicts:
#	gns3server/compute/base_node.py
#	gns3server/version.py
#	gns3server/web/web_server.py
This commit is contained in:
grossmj 2020-12-07 18:00:33 +10:30
commit 6aefb5d32b
18 changed files with 102 additions and 24 deletions

View File

@ -1,5 +1,12 @@
# Change Log # Change Log
## 2.2.17 04/12/2020
* Close and remove projects deleted from disks after SIGHUP signal is received.
* Release Web Ui 2.2.17
* New config file options to configure the VNC console port range.
* Use asyncio.all_tasks instead of deprecated method for Python 3.9 compatibility.
## 2.2.16 05/11/2020 ## 2.2.16 05/11/2020
* Option to allocate or not the vCPUs and RAM settings for the GNS3 VM. Fixes https://github.com/GNS3/gns3-gui/issues/3069 * Option to allocate or not the vCPUs and RAM settings for the GNS3 VM. Fixes https://github.com/GNS3/gns3-gui/issues/3069

View File

@ -28,10 +28,19 @@ report_errors = True
console_start_port_range = 5000 console_start_port_range = 5000
; Last console port of the range allocated to devices ; Last console port of the range allocated to devices
console_end_port_range = 10000 console_end_port_range = 10000
; First VNC console port of the range allocated to devices.
; The value MUST BE >= 5900 and <= 65535
vnc_console_start_port_range = 5900
; Last VNC console port of the range allocated to devices
; The value MUST BE >= 5900 and <= 65535
vnc_console_end_port_range = 10000
; First port of the range allocated for inter-device communication. Two ports are allocated per link. ; First port of the range allocated for inter-device communication. Two ports are allocated per link.
udp_start_port_range = 20000 udp_start_port_range = 20000
; Last port of the range allocated for inter-device communication. Two ports are allocated per link ; Last port of the range allocated for inter-device communication. Two ports are allocated per link
udp_end_port_range = 30000 udp_end_port_range = 30000
; uBridge executable location, default: search in PATH ; uBridge executable location, default: search in PATH
;ubridge_path = ubridge ;ubridge_path = ubridge

View File

@ -87,8 +87,13 @@ class BaseNode:
if self._console is not None: if self._console is not None:
# use a previously allocated console port # use a previously allocated console port
if console_type == "vnc": if console_type == "vnc":
# VNC is a special case and the range must be 5900-6000 vnc_console_start_port_range, vnc_console_end_port_range = self._get_vnc_console_port_range()
self._console = self._manager.port_manager.reserve_tcp_port(self._console, self._project, port_range_start=5900, port_range_end=6000) self._console = self._manager.port_manager.reserve_tcp_port(
self._console,
self._project,
port_range_start=vnc_console_start_port_range,
port_range_end=vnc_console_end_port_range,
)
elif console_type == "none": elif console_type == "none":
self._console = None self._console = None
else: else:
@ -107,8 +112,11 @@ class BaseNode:
if self._console is None: if self._console is None:
# allocate a new console # allocate a new console
if console_type == "vnc": if console_type == "vnc":
# VNC is a special case and the range must be 5900-6000 vnc_console_start_port_range, vnc_console_end_port_range = self._get_vnc_console_port_range()
self._console = self._manager.port_manager.get_free_tcp_port(self._project, port_range_start=5900, port_range_end=6000) self._console = self._manager.port_manager.get_free_tcp_port(
self._project,
port_range_start=vnc_console_start_port_range,
port_range_end=vnc_console_end_port_range)
elif console_type != "none": elif console_type != "none":
self._console = self._manager.port_manager.get_free_tcp_port(self._project) self._console = self._manager.port_manager.get_free_tcp_port(self._project)
@ -360,7 +368,30 @@ class BaseNode:
self._closed = True self._closed = True
return True return True
def _get_vnc_console_port_range(self):
"""
Returns the VNC console port range.
"""
server_config = self._manager.config.get_section_config("Server")
vnc_console_start_port_range = server_config.getint("vnc_console_start_port_range", 5900)
vnc_console_end_port_range = server_config.getint("vnc_console_end_port_range", 10000)
if not 5900 <= vnc_console_start_port_range <= 65535:
raise NodeError("The VNC console start port range must be between 5900 and 65535")
if not 5900 <= vnc_console_end_port_range <= 65535:
raise NodeError("The VNC console start port range must be between 5900 and 65535")
if vnc_console_start_port_range >= vnc_console_end_port_range:
raise NodeError(f"The VNC console start port range value ({vnc_console_start_port_range}) "
f"cannot be above or equal to the end value ({vnc_console_end_port_range})")
return vnc_console_start_port_range, vnc_console_end_port_range
async def _wrap_telnet_proxy(self, internal_port, external_port): async def _wrap_telnet_proxy(self, internal_port, external_port):
"""
Start a telnet proxy for the console allowing multiple telnet clients
to be connected at the same time
"""
remaining_trial = 60 remaining_trial = 60
while True: while True:
@ -533,7 +564,13 @@ class BaseNode:
self._console = None self._console = None
if console is not None: if console is not None:
if self.console_type == "vnc": if self.console_type == "vnc":
self._console = self._manager.port_manager.reserve_tcp_port(console, self._project, port_range_start=5900, port_range_end=6000) vnc_console_start_port_range, vnc_console_end_port_range = self._get_vnc_console_port_range()
self._console = self._manager.port_manager.reserve_tcp_port(
console,
self._project,
port_range_start=vnc_console_start_port_range,
port_range_end=vnc_console_end_port_range
)
else: else:
self._console = self._manager.port_manager.reserve_tcp_port(console, self._project) self._console = self._manager.port_manager.reserve_tcp_port(console, self._project)

View File

@ -169,6 +169,14 @@ class Controller:
log.info("Controller is reloading") log.info("Controller is reloading")
self._load_controller_settings() self._load_controller_settings()
# remove all projects deleted from disk.
for project in self._projects.copy().values():
if not os.path.exists(project.path):
log.info(f"Project '{project.name}' doesn't exist on the disk anymore, closing...")
await project.close()
self.remove_project(project)
await self.load_projects() await self.load_projects()
def check_can_write_config(self): def check_can_write_config(self):

View File

@ -58,7 +58,7 @@ class CrashReport:
Report crash to a third party service Report crash to a third party service
""" """
DSN = "https://026410fd151843438d078e604f2e4455:1792bf69988342c7b44f8a69ae0cad6f@o19455.ingest.sentry.io/38482" DSN = "https://8c30fa3843ab4cdc977e4710cefac0b1:212efa491b1b459f87a0242cb2598e0c@o19455.ingest.sentry.io/38482"
_instance = None _instance = None
def __init__(self): def __init__(self):

View File

@ -2526,6 +2526,23 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
spark-md5
WTFPL
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2015 André Cruz <amdfcruz@gmail.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
svg-crowbar svg-crowbar
MIT MIT
Copyright (c) 2013 The New York Times Copyright (c) 2013 The New York Times

View File

@ -4,7 +4,7 @@
<meta charset="utf-8"/> <meta charset="utf-8"/>
<title>GNS3 Web UI</title> <title>GNS3 Web UI</title>
<!-- It's important to have base here because of the script below //--> <!-- It's important to have base here because of the script below //-->
<base href="/static/web-ui/"> <base href="/static/web-ui/"/>
<script> <script>
var userAgent = navigator.userAgent.toLowerCase(); var userAgent = navigator.userAgent.toLowerCase();
@ -33,12 +33,12 @@
} }
})(); })();
</script> </script>
<link rel="stylesheet" href="styles.93c3010ec8fa34732040.css"></head> <link rel="stylesheet" href="styles.2c581a0a91b7aa4f301d.css"><link rel="stylesheet" href="theme-default-dark.0c2d0b433828ffcae19b.css"><link rel="stylesheet" href="theme-default.3b76617748d593b91f1e.css"></head>
<!-- <body class="mat-app-background" oncontextmenu="return false;"> --> <!-- <body class="mat-app-background" oncontextmenu="return false;"> -->
<body class="mat-app-background" oncontextmenu="return false;"> <body class="mat-app-background" oncontextmenu="return false;">
<app-root></app-root> <app-root></app-root>
<!-- Global site tag (gtag.js) - Google Analytics --> <!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-5D6FZL9923"></script> <script async="" src="https://www.googletagmanager.com/gtag/js?id=G-5D6FZL9923"></script>
<script> <script>
window.dataLayer = window.dataLayer || []; window.dataLayer = window.dataLayer || [];
function gtag() function gtag()
@ -48,5 +48,5 @@
gtag('config', 'G-5D6FZL9923'); gtag('config', 'G-5D6FZL9923');
</script> </script>
<script src="runtime.acf0dec4155e77772545.js" defer></script><script src="polyfills-es5.81e70f503de320d59b44.js" nomodule defer></script><script src="polyfills.7ae454d57e44d75e5d10.js" defer></script><script src="main.8367ffc0bf45ea7cf3c7.js" defer></script></body> <script src="runtime.b3b0f3122d9d931b48a7.js" defer></script><script src="polyfills-es5.0e607f2e1ad7b467b484.js" nomodule defer></script><script src="polyfills.d6c8f09f3c92e4ec2a1f.js" defer></script><script src="main.653d70aeac9ae0ee8541.js" defer></script></body>
</html> </html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long