mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-28 11:18:11 +00:00
Fixes check if VPCS process is running.
This commit is contained in:
parent
7d8ff54c78
commit
ec6a761e04
@ -81,7 +81,8 @@ class VPCSVM(BaseVM):
|
|||||||
if isinstance(nio, NIOUDP):
|
if isinstance(nio, NIOUDP):
|
||||||
self.manager.port_manager.release_udp_port(nio.lport, self._project)
|
self.manager.port_manager.release_udp_port(nio.lport, self._project)
|
||||||
|
|
||||||
self._terminate_process()
|
if self.is_running():
|
||||||
|
self._terminate_process()
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def _check_requirements(self):
|
def _check_requirements(self):
|
||||||
@ -264,16 +265,15 @@ class VPCSVM(BaseVM):
|
|||||||
def _terminate_process(self):
|
def _terminate_process(self):
|
||||||
"""Terminate the process if running"""
|
"""Terminate the process if running"""
|
||||||
|
|
||||||
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))
|
if sys.platform.startswith("win32"):
|
||||||
if sys.platform.startswith("win32"):
|
self._process.send_signal(signal.CTRL_BREAK_EVENT)
|
||||||
self._process.send_signal(signal.CTRL_BREAK_EVENT)
|
else:
|
||||||
else:
|
try:
|
||||||
try:
|
self._process.terminate()
|
||||||
self._process.terminate()
|
# Sometime the process can already be dead when we garbage collect
|
||||||
# Sometime the process can already be dead when we garbage collect
|
except ProcessLookupError:
|
||||||
except ProcessLookupError:
|
pass
|
||||||
pass
|
|
||||||
|
|
||||||
def read_vpcs_stdout(self):
|
def read_vpcs_stdout(self):
|
||||||
"""
|
"""
|
||||||
@ -296,7 +296,7 @@ class VPCSVM(BaseVM):
|
|||||||
:returns: True or False
|
:returns: True or False
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if self._process:
|
if self._process and self._process.returncode is None:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user