Skip to content

Commit

Permalink
Fix wrong regex in cleanup_file_locks.
Browse files Browse the repository at this point in the history
The sentinel filename actually has form hostname-threadid.pid,
not hostname.threadid-pid.
Launchpad bug 1018586.
Change-Id: I09c01e0e63ee704b1485c196dc0b396ee03b2e5c
  • Loading branch information
jkff committed Jul 23, 2012
1 parent 563ed09 commit 974417b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion nova/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ def _get_dead_pid(self):

def _get_sentinel_name(self, hostname, pid, thread='MainThread'):
return os.path.join(FLAGS.lock_path,
'%s.%s-%d' % (hostname, thread, pid))
'%s-%s.%d' % (hostname, thread, pid))

def _create_sentinel(self, hostname, pid, thread='MainThread'):
name = self._get_sentinel_name(hostname, pid, thread)
Expand Down
2 changes: 1 addition & 1 deletion nova/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ def cleanup_file_locks():
return

hostname = socket.gethostname()
sentinel_re = hostname + r'\..*-(\d+$)'
sentinel_re = hostname + r'-.*\.(\d+$)'
lockfile_re = r'nova-.*\.lock'
files = os.listdir(FLAGS.lock_path)

Expand Down

0 comments on commit 974417b

Please sign in to comment.