Wait more time for ioucon thread to be completed. Prevent IOS to be

started or stopped if the status isn't right.
This commit is contained in:
grossmj committed 2014-05-16 12:35:48 -06:00
1 parent 9b55a8623c
commit 6a839c4b7b
5 files changed
+66 -40

No files matched your search

+15 -15
View File
@@ -523,25 +523,11 @@ class IOUDevice(object):
Stops the IOU process.
"""
# stop the IOU process
if self.is_running():
log.info("stopping IOU instance {} PID={}".format(self._id, self._process.pid))
try:
self._process.terminate()
self._process.wait(1)
except subprocess.TimeoutExpired:
self._process.kill()
if self._process.poll() == None:
log.warn("IOU instance {} PID={} is still running".format(self._id,
self._process.pid))
self._process = None
self._started = False
# stop console support
if self._ioucon_thead:
self._ioucon_thread_stop_event.set()
if self._ioucon_thead.is_alive():
self._ioucon_thead.join(timeout=0.10)
self._ioucon_thead.join(timeout=3.0) # wait for the thread to free the console port
self._ioucon_thead = None
# stop iouyap
@@ -557,6 +543,20 @@ class IOUDevice(object):
self._id))
self._iouyap_process = None
# stop the IOU process
if self.is_running():
log.info("stopping IOU instance {} PID={}".format(self._id, self._process.pid))
try:
self._process.terminate()
self._process.wait(1)
except subprocess.TimeoutExpired:
self._process.kill()
if self._process.poll() == None:
log.warn("IOU instance {} PID={} is still running".format(self._id,
self._process.pid))
self._process = None
self._started = False
def read_iou_stdout(self):
"""
Reads the standard output of the IOU process.
+4 -1
View File
@@ -139,7 +139,10 @@ class FileLock:
def unlock(self):
if self.fd:
# Deleting first prevents a race condition
os.unlink(self.fd.name)
try:
os.unlink(self.fd.name)
except FileNotFoundError as e:
log.debug("{}".format(e))
self.fd.close()
def __enter__(self):