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

Fix tests related to console type changes.

This commit is contained in:
grossmj 2018-03-23 21:29:39 +07:00
parent b6275deeef
commit 54661c50b2

View File

@ -89,6 +89,13 @@ class BaseNode:
if self._aux is not None:
self._aux = self._manager.port_manager.reserve_tcp_port(self._aux, self._project)
if self._console is None:
if console_type == "vnc":
# VNC is a special case and the range must be 5900-6000
self._console = self._manager.port_manager.get_free_tcp_port(self._project, port_range_start=5900, port_range_end=6000)
elif console_type != "none":
self._console = self._manager.port_manager.get_free_tcp_port(self._project)
if self._wrap_console:
self._internal_console_port = self._manager.port_manager.get_free_tcp_port(self._project)
@ -451,7 +458,8 @@ class BaseNode:
if console_type != self._console_type:
# get a new port if the console type change
self._manager.port_manager.release_tcp_port(self._console, self._project)
if self._console:
self._manager.port_manager.release_tcp_port(self._console, self._project)
if console_type == "none":
# no need to allocate a port when the console type is none
self._console = None