mirror of
https://github.com/GNS3/gns3-server
synced 2025-01-12 09:00:57 +00:00
Fix closing console of VBox on NIX systems
This commit is contained in:
parent
11f290482d
commit
a872f0328d
@ -284,7 +284,7 @@ class VirtualBoxVM(BaseNode):
|
|||||||
|
|
||||||
self._hw_virtualization = False
|
self._hw_virtualization = False
|
||||||
yield from self._stop_ubridge()
|
yield from self._stop_ubridge()
|
||||||
self._stop_remote_console()
|
yield from self._stop_remote_console()
|
||||||
vm_state = yield from self._get_vm_state()
|
vm_state = yield from self._get_vm_state()
|
||||||
if vm_state == "running" or vm_state == "paused" or vm_state == "stuck":
|
if vm_state == "running" or vm_state == "paused" or vm_state == "stuck":
|
||||||
if self.acpi_shutdown:
|
if self.acpi_shutdown:
|
||||||
@ -312,6 +312,7 @@ class VirtualBoxVM(BaseNode):
|
|||||||
yield from self._modify_vm("--nictrace{} off".format(adapter_number + 1))
|
yield from self._modify_vm("--nictrace{} off".format(adapter_number + 1))
|
||||||
yield from self._modify_vm("--cableconnected{} off".format(adapter_number + 1))
|
yield from self._modify_vm("--cableconnected{} off".format(adapter_number + 1))
|
||||||
yield from self._modify_vm("--nic{} null".format(adapter_number + 1))
|
yield from self._modify_vm("--nic{} null".format(adapter_number + 1))
|
||||||
|
yield from super().stop()
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def suspend(self):
|
def suspend(self):
|
||||||
@ -898,16 +899,23 @@ class VirtualBoxVM(BaseNode):
|
|||||||
"""
|
"""
|
||||||
Starts remote console support for this VM.
|
Starts remote console support for this VM.
|
||||||
"""
|
"""
|
||||||
pipe = yield from asyncio_open_serial(self._get_pipe_name())
|
self._remote_pipe = yield from asyncio_open_serial(self._get_pipe_name())
|
||||||
server = AsyncioTelnetServer(reader=pipe, writer=pipe, binary=True, echo=True)
|
server = AsyncioTelnetServer(reader=self._remote_pipe,
|
||||||
|
writer=self._remote_pipe,
|
||||||
|
binary=True,
|
||||||
|
echo=True)
|
||||||
self._telnet_server = yield from asyncio.start_server(server.run, '127.0.0.1', self.console)
|
self._telnet_server = yield from asyncio.start_server(server.run, '127.0.0.1', self.console)
|
||||||
|
|
||||||
|
@asyncio.coroutine
|
||||||
def _stop_remote_console(self):
|
def _stop_remote_console(self):
|
||||||
"""
|
"""
|
||||||
Stops remote console support for this VM.
|
Stops remote console support for this VM.
|
||||||
"""
|
"""
|
||||||
if self._telnet_server:
|
if self._telnet_server:
|
||||||
self._telnet_server.close()
|
self._telnet_server.close()
|
||||||
|
yield from self._telnet_server.wait_closed()
|
||||||
|
self._remote_pipe.close()
|
||||||
|
self._telnet_server = None
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def adapter_add_nio_binding(self, adapter_number, nio):
|
def adapter_add_nio_binding(self, adapter_number, nio):
|
||||||
|
@ -460,7 +460,7 @@ class VMwareVM(BaseNode):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
self._hw_virtualization = False
|
self._hw_virtualization = False
|
||||||
self._stop_remote_console()
|
yield from self._stop_remote_console()
|
||||||
yield from self._stop_ubridge()
|
yield from self._stop_ubridge()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -495,6 +495,7 @@ class VMwareVM(BaseNode):
|
|||||||
self._vmx_pairs["ethernet{}.startconnected".format(adapter_number)] = "TRUE"
|
self._vmx_pairs["ethernet{}.startconnected".format(adapter_number)] = "TRUE"
|
||||||
self._write_vmx_file()
|
self._write_vmx_file()
|
||||||
|
|
||||||
|
yield from super().stop()
|
||||||
log.info("VMware VM '{name}' [{id}] stopped".format(name=self.name, id=self.id))
|
log.info("VMware VM '{name}' [{id}] stopped".format(name=self.name, id=self.id))
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
@ -799,16 +800,23 @@ class VMwareVM(BaseNode):
|
|||||||
"""
|
"""
|
||||||
Starts remote console support for this VM.
|
Starts remote console support for this VM.
|
||||||
"""
|
"""
|
||||||
pipe = yield from asyncio_open_serial(self._get_pipe_name())
|
self._remote_pipe = yield from asyncio_open_serial(self._get_pipe_name())
|
||||||
server = AsyncioTelnetServer(reader=pipe, writer=pipe, binary=True, echo=True)
|
server = AsyncioTelnetServer(reader=self._remote_pipe,
|
||||||
|
writer=self._remote_pipe,
|
||||||
|
binary=True,
|
||||||
|
echo=True)
|
||||||
self._telnet_server = yield from asyncio.start_server(server.run, '127.0.0.1', self.console)
|
self._telnet_server = yield from asyncio.start_server(server.run, '127.0.0.1', self.console)
|
||||||
|
|
||||||
|
@asyncio.coroutine
|
||||||
def _stop_remote_console(self):
|
def _stop_remote_console(self):
|
||||||
"""
|
"""
|
||||||
Stops remote console support for this VM.
|
Stops remote console support for this VM.
|
||||||
"""
|
"""
|
||||||
if self._telnet_server:
|
if self._telnet_server:
|
||||||
self._telnet_server.close()
|
self._telnet_server.close()
|
||||||
|
yield from self._telnet_server.wait_closed()
|
||||||
|
self._remote_pipe.close()
|
||||||
|
self._telnet_server = None
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def start_capture(self, adapter_number, output_file):
|
def start_capture(self, adapter_number, output_file):
|
||||||
|
@ -56,6 +56,9 @@ class SerialReaderWriterProtocol(asyncio.Protocol):
|
|||||||
def data_received(self, data):
|
def data_received(self, data):
|
||||||
self._output.feed_data(data)
|
self._output.feed_data(data)
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
self._output.feed_eof()
|
||||||
|
|
||||||
|
|
||||||
class WindowsPipe:
|
class WindowsPipe:
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user