From 54661c50b28681f63a1c9731be7c2e14f8f1a684 Mon Sep 17 00:00:00 2001 From: grossmj Date: Fri, 23 Mar 2018 21:29:39 +0700 Subject: [PATCH] Fix tests related to console type changes. --- gns3server/compute/base_node.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gns3server/compute/base_node.py b/gns3server/compute/base_node.py index 1d9830fd..0f7489ba 100644 --- a/gns3server/compute/base_node.py +++ b/gns3server/compute/base_node.py @@ -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