Fixes how to test if iou and iouyap are running.

This commit is contained in:
grossmj 2015-03-24 22:04:48 -06:00
parent 980e63e667
commit 07067d6765

View File

@ -597,10 +597,9 @@ 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)
@ -608,14 +607,13 @@ class IOUVM(BaseVM):
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()
@ -626,7 +624,6 @@ class IOUVM(BaseVM):
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()
@ -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