From 6e6ef5589e8898f898b0d986db90e1e2356e889f Mon Sep 17 00:00:00 2001 From: Joe Gordon Date: Mon, 27 Feb 2012 17:20:21 -0800 Subject: OS X Support fixed, bug 942352 Change-Id: I3aa28ba46b0418310637dfeacbdea60361a7a280 --- nova/tests/test_utils.py | 2 +- nova/utils.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/nova/tests/test_utils.py b/nova/tests/test_utils.py index 843b48dd3..f0c285869 100644 --- a/nova/tests/test_utils.py +++ b/nova/tests/test_utils.py @@ -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) diff --git a/nova/utils.py b/nova/utils.py index 6bb0dd0f2..d631afbfd 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -901,10 +901,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: -- cgit