mirror of
https://github.com/GNS3/gns3-server
synced 2025-01-26 07:51:13 +00:00
Fixes how to test if iou and iouyap are running.
This commit is contained in:
parent
980e63e667
commit
07067d6765
@ -597,42 +597,39 @@ class IOUVM(BaseVM):
|
|||||||
if self._iou_process.returncode is None:
|
if self._iou_process.returncode is None:
|
||||||
log.warn("IOU process {} is still running... killing it".format(self._iou_process.pid))
|
log.warn("IOU process {} is still running... killing it".format(self._iou_process.pid))
|
||||||
self._iou_process.kill()
|
self._iou_process.kill()
|
||||||
|
|
||||||
self._iou_process = None
|
self._iou_process = None
|
||||||
|
|
||||||
if self._iouyap_process is not None:
|
if self.is_iouyap_running():
|
||||||
self._terminate_process_iouyap()
|
self._terminate_process_iouyap()
|
||||||
try:
|
try:
|
||||||
yield from gns3server.utils.asyncio.wait_for_process_termination(self._iouyap_process, timeout=3)
|
yield from gns3server.utils.asyncio.wait_for_process_termination(self._iouyap_process, timeout=3)
|
||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
if self._iouyap_process.returncode is None:
|
if self._iouyap_process.returncode is None:
|
||||||
log.warn("IOUYAP process {} is still running... killing it".format(self._iouyap_process.pid))
|
log.warn("IOUYAP process {} is still running... killing it".format(self._iouyap_process.pid))
|
||||||
self._iouyap_process.kill()
|
self._iouyap_process.kill()
|
||||||
|
|
||||||
self._iouyap_process = None
|
self._iouyap_process = None
|
||||||
self._started = False
|
|
||||||
|
self._started = False
|
||||||
|
|
||||||
def _terminate_process_iouyap(self):
|
def _terminate_process_iouyap(self):
|
||||||
"""Terminate the process if running"""
|
"""Terminate the process if running"""
|
||||||
|
|
||||||
if self._iouyap_process:
|
log.info("Stopping IOUYAP instance {} PID={}".format(self.name, self._iouyap_process.pid))
|
||||||
log.info("Stopping IOUYAP instance {} PID={}".format(self.name, self._iouyap_process.pid))
|
try:
|
||||||
try:
|
self._iouyap_process.terminate()
|
||||||
self._iouyap_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 _terminate_process_iou(self):
|
def _terminate_process_iou(self):
|
||||||
"""Terminate the process if running"""
|
"""Terminate the process if running"""
|
||||||
|
|
||||||
if self._iou_process:
|
log.info("Stopping IOU instance {} PID={}".format(self.name, self._iou_process.pid))
|
||||||
log.info("Stopping IOU instance {} PID={}".format(self.name, self._iou_process.pid))
|
try:
|
||||||
try:
|
self._iou_process.terminate()
|
||||||
self._iou_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
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def reload(self):
|
def reload(self):
|
||||||
@ -650,7 +647,7 @@ class IOUVM(BaseVM):
|
|||||||
:returns: True or False
|
:returns: True or False
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if self._iou_process:
|
if self._iou_process and self._iou_process.returncode is None:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -661,7 +658,7 @@ class IOUVM(BaseVM):
|
|||||||
:returns: True or False
|
:returns: True or False
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if self._iouyap_process:
|
if self._iouyap_process and self._iouyap_process.returncode is None:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user