Support for none console type (Qemu & Docker only)

This commit is contained in:
grossmj committed 2018-03-23 15:44:16 +07:00
1 parent a40fdb3641
commit b8353bc0d5
6 files changed
+17 -19

No files matched your search

+6 -8
View File
@@ -76,9 +76,11 @@ class BaseNode:
self._allocate_aux = allocate_aux
self._wrap_console = wrap_console
self._wrapper_telnet_server = None
self._internal_console_port = None
if self._console is not None:
if console_type == "vnc":
# VNC is a special case and the range must be 5900-6000
self._console = self._manager.port_manager.reserve_tcp_port(self._console, self._project, port_range_start=5900, port_range_end=6000)
else:
self._console = self._manager.port_manager.reserve_tcp_port(self._console, self._project)
@@ -87,13 +89,6 @@ 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)
else:
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)
@@ -457,7 +452,10 @@ 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 console_type == "vnc":
if console_type == "none":
# no need to allocate a port when the console type is none
self._console = None
elif 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, 5900, 6000)
else:
+2 -2
View File
@@ -973,7 +973,7 @@ class QemuVM(BaseNode):
try:
yield from self.start_wrap_console()
except OSError as e:
raise QemuError("Could not start QEMU console {}\n".format(e))
raise QemuError("Could not start Telnet QEMU console {}\n".format(e))
@asyncio.coroutine
def _termination_callback(self, returncode):
@@ -1803,7 +1803,7 @@ class QemuVM(BaseNode):
command.extend(self._vnc_options())
elif self._console_type == "spice":
command.extend(self._spice_options())
else:
elif self._console_type != "none":
raise QemuError("Console type {} is unknown".format(self._console_type))
command.extend(self._monitor_options())
command.extend((yield from self._network_options()))