Merge "OS X Support fixed, bug 942352"

This commit is contained in:
Jenkins
2012-02-28 19:17:07 +00:00
committed by Gerrit Code Review
2 changed files with 6 additions and 3 deletions

View File

@@ -857,7 +857,7 @@ class TestLockCleanup(test.TestCase):
"""verify locks for dead processes are cleaned up"""
# create sentinels for two processes, us and a 'dead' one
# no actve lock
# no active lock
sentinel1 = self._create_sentinel(self.hostname, self.pid)
sentinel2 = self._create_sentinel(self.hostname, self.dead_pid)

View File

@@ -903,10 +903,13 @@ def cleanup_file_locks():
pid = match.group(1)
LOG.debug(_('Found sentinel %(filename)s for pid %(pid)s' %
{'filename': filename, 'pid': pid}))
if not os.path.exists(os.path.join('/proc', pid)):
try:
os.kill(int(pid), 0)
except OSError, e:
# PID wasn't found
delete_if_exists(os.path.join(FLAGS.lock_path, filename))
LOG.debug(_('Cleaned sentinel %(filename)s for pid %(pid)s' %
{'filename': filename, 'pid': pid}))
{'filename': filename, 'pid': pid}))
# cleanup lock files
for filename in files: