mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-26 00:38:10 +00:00
Add timeout on stopping a VPCS just in case.
This commit is contained in:
parent
b31af0abcd
commit
98586b93ee
@ -74,7 +74,7 @@ class VPCSVM(BaseVM):
|
|||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
|
|
||||||
self._kill_process()
|
self._terminate_process()
|
||||||
if self._console:
|
if self._console:
|
||||||
self._manager.port_manager.release_console_port(self._console)
|
self._manager.port_manager.release_console_port(self._console)
|
||||||
self._console = None
|
self._console = None
|
||||||
@ -251,10 +251,14 @@ class VPCSVM(BaseVM):
|
|||||||
Stops the VPCS process.
|
Stops the VPCS process.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# stop the VPCS process
|
|
||||||
if self.is_running():
|
if self.is_running():
|
||||||
self._kill_process()
|
self._terminate_process()
|
||||||
yield from self._process.wait()
|
try:
|
||||||
|
yield from asyncio.wait_for(self._process.wait(), timeout=10)
|
||||||
|
except asyncio.TimeoutError:
|
||||||
|
self._process.kill()
|
||||||
|
if self._process.poll() is None:
|
||||||
|
log.warn("VPCS process {} is still running".format(self._process.pid))
|
||||||
|
|
||||||
self._process = None
|
self._process = None
|
||||||
self._started = False
|
self._started = False
|
||||||
@ -268,8 +272,8 @@ class VPCSVM(BaseVM):
|
|||||||
yield from self.stop()
|
yield from self.stop()
|
||||||
yield from self.start()
|
yield from self.start()
|
||||||
|
|
||||||
def _kill_process(self):
|
def _terminate_process(self):
|
||||||
"""Kill the process if running"""
|
"""Terminate the process if running"""
|
||||||
|
|
||||||
if self._process:
|
if self._process:
|
||||||
log.info("Stopping VPCS instance {} PID={}".format(self.name, self._process.pid))
|
log.info("Stopping VPCS instance {} PID={}".format(self.name, self._process.pid))
|
||||||
|
Loading…
Reference in New Issue
Block a user