Break up the logging around the lockfile release/unlock

To be better able to identify when and where are file lock
breaks when release occurs it's useful to distingush the
different steps of release and independently log them as
unique steps.

Change-Id: I3b605994ca7673e5c97e73821d2ea777117f5f09
This commit is contained in:
Joshua Harlow 2014-09-16 14:15:29 -07:00
parent ca01f962c9
commit 6a0fb778c6

View File

@ -117,12 +117,20 @@ class _FileLock(object):
def release(self):
try:
LOG.debug('Releasing file lock "%s"', self.fname)
self.unlock()
self.lockfile.close()
LOG.debug('Released file lock "%s"', self.fname)
except IOError:
LOG.exception(_LE("Could not release the acquired lock `%s`"),
LOG.exception(_LE("Could not unlock the acquired lock `%s`"),
self.fname)
else:
try:
self.lockfile.close()
except IOError:
LOG.exception(_LE("Could not close the acquired file handle"
" `%s`"), self.fname)
else:
LOG.debug('Released and closed file lock associated with'
' "%s"', self.fname)
def __exit__(self, exc_type, exc_val, exc_tb):
self.release()