mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-05-29 13:54:28 +00:00
Fix cannot stop Docker VM while console connection is still active.
This commit is contained in:
parent
a80aed5420
commit
5b1ba5a57c
@ -481,6 +481,9 @@ class DockerVM(BaseNode):
|
|||||||
await self._start_vnc_process(restart=True)
|
await self._start_vnc_process(restart=True)
|
||||||
monitor_process(self._vnc_process, self._vnc_callback)
|
monitor_process(self._vnc_process, self._vnc_callback)
|
||||||
|
|
||||||
|
if self._console_websocket:
|
||||||
|
await self._console_websocket.close()
|
||||||
|
self._console_websocket = None
|
||||||
await self._clean_servers()
|
await self._clean_servers()
|
||||||
|
|
||||||
await self.manager.query("POST", "containers/{}/start".format(self._cid))
|
await self.manager.query("POST", "containers/{}/start".format(self._cid))
|
||||||
@ -702,9 +705,7 @@ class DockerVM(BaseNode):
|
|||||||
|
|
||||||
self._console_websocket = await self.manager.websocket_query("containers/{}/attach/ws?stream=1&stdin=1&stdout=1&stderr=1".format(self._cid))
|
self._console_websocket = await self.manager.websocket_query("containers/{}/attach/ws?stream=1&stdin=1&stdout=1&stderr=1".format(self._cid))
|
||||||
input_stream.ws = self._console_websocket
|
input_stream.ws = self._console_websocket
|
||||||
|
|
||||||
output_stream.feed_data(self.name.encode() + b" console is now available... Press RETURN to get started.\r\n")
|
output_stream.feed_data(self.name.encode() + b" console is now available... Press RETURN to get started.\r\n")
|
||||||
|
|
||||||
asyncio.ensure_future(self._read_console_output(self._console_websocket, output_stream))
|
asyncio.ensure_future(self._read_console_output(self._console_websocket, output_stream))
|
||||||
|
|
||||||
async def _read_console_output(self, ws, out):
|
async def _read_console_output(self, ws, out):
|
||||||
@ -727,13 +728,14 @@ class DockerVM(BaseNode):
|
|||||||
out.feed_eof()
|
out.feed_eof()
|
||||||
await ws.close()
|
await ws.close()
|
||||||
break
|
break
|
||||||
await self.stop()
|
|
||||||
|
|
||||||
async def reset_console(self):
|
async def reset_console(self):
|
||||||
"""
|
"""
|
||||||
Reset the console.
|
Reset the console.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if self._console_websocket:
|
||||||
|
await self._console_websocket.close()
|
||||||
await self._clean_servers()
|
await self._clean_servers()
|
||||||
await self._start_console()
|
await self._start_console()
|
||||||
|
|
||||||
@ -778,6 +780,9 @@ class DockerVM(BaseNode):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
if self._console_websocket:
|
||||||
|
await self._console_websocket.close()
|
||||||
|
self._console_websocket = None
|
||||||
await self._clean_servers()
|
await self._clean_servers()
|
||||||
await self._stop_ubridge()
|
await self._stop_ubridge()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user