mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-04 06:21:15 +02:00
Support to reset all console connections. Ref https://github.com/GNS3/gns3-server/issues/1619
This commit is contained in:
1 parent
4acc457674
commit
bdd703a0dc
17 files changed
+283
-7
No files matched your search
@@ -569,17 +569,39 @@ class IOUVM(BaseNode):
|
||||
log.error("Could not start IOU {}: {}\n{}".format(self._path, e, iou_stdout))
|
||||
raise IOUError("Could not start IOU {}: {}\n{}".format(self._path, e, iou_stdout))
|
||||
|
||||
if self.console and self.console_type == "telnet":
|
||||
server = AsyncioTelnetServer(reader=self._iou_process.stdout, writer=self._iou_process.stdin, binary=True, echo=True)
|
||||
try:
|
||||
self._telnet_server = await asyncio.start_server(server.run, self._manager.port_manager.console_host, self.console)
|
||||
except OSError as e:
|
||||
await self.stop()
|
||||
raise IOUError("Could not start Telnet server on socket {}:{}: {}".format(self._manager.port_manager.console_host, self.console, e))
|
||||
await self.start_console()
|
||||
|
||||
# configure networking support
|
||||
await self._networking()
|
||||
|
||||
async def start_console(self):
|
||||
"""
|
||||
Start the Telnet server to provide console access.
|
||||
"""
|
||||
|
||||
if self.console and self.console_type == "telnet":
|
||||
server = AsyncioTelnetServer(reader=self._iou_process.stdout, writer=self._iou_process.stdin, binary=True,
|
||||
echo=True)
|
||||
try:
|
||||
self._telnet_server = await asyncio.start_server(server.run, self._manager.port_manager.console_host,
|
||||
self.console)
|
||||
except OSError as e:
|
||||
await self.stop()
|
||||
raise IOUError(
|
||||
"Could not start Telnet server on socket {}:{}: {}".format(self._manager.port_manager.console_host,
|
||||
self.console, e))
|
||||
|
||||
async def reset_console(self):
|
||||
"""
|
||||
Reset the console.
|
||||
"""
|
||||
|
||||
if self._telnet_server:
|
||||
self._telnet_server.close()
|
||||
await self._telnet_server.wait_closed()
|
||||
self._telnet_server = None
|
||||
await self.start_console()
|
||||
|
||||
@locking
|
||||
async def _networking(self):
|
||||
"""
|
||||
|
||||
Reference in new issue
Block a user