diff options
author | Russell Bryant <rbryant@redhat.com> | 2013-03-25 10:37:02 -0400 |
---|---|---|
committer | Russell Bryant <rbryant@redhat.com> | 2013-03-25 10:37:02 -0400 |
commit | 817bdebb7cda941182d50d6edd14b56c2aec0ded (patch) | |
tree | 79e5e5e63204354b341e76a700b8f6d9b7fdffa2 | |
parent | 8e2a7a3b62d89a9da4c11afaffcc60f76a44ad76 (diff) | |
download | nova-817bdebb7cda941182d50d6edd14b56c2aec0ded.tar.gz |
Sync lockutils from oslo-incubator stable/grizzly.
Changes include:
3cb71ff Locking edge case when lock_path does not exist
21925b6 Fix locking issues in Windows
547ab34 Fix Copyright Headers - Rename LLC to Foundation
Fix bug 1158179.
Change-Id: I8231a6d37b70c36ba2ce245407b02698faa55aaf
-rw-r--r-- | nova/openstack/common/lockutils.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/nova/openstack/common/lockutils.py b/nova/openstack/common/lockutils.py index 3270f04736..e1af8bac70 100644 --- a/nova/openstack/common/lockutils.py +++ b/nova/openstack/common/lockutils.py @@ -1,6 +1,6 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright 2011 OpenStack Foundation +# Copyright 2011 OpenStack Foundation. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -32,6 +32,7 @@ from nova.openstack.common.gettextutils import _ from nova.openstack.common import local from nova.openstack.common import log as logging + LOG = logging.getLogger(__name__) @@ -106,10 +107,10 @@ class _InterProcessLock(object): class _WindowsLock(_InterProcessLock): def trylock(self): - msvcrt.locking(self.lockfile, msvcrt.LK_NBLCK, 1) + msvcrt.locking(self.lockfile.fileno(), msvcrt.LK_NBLCK, 1) def unlock(self): - msvcrt.locking(self.lockfile, msvcrt.LK_UNLCK, 1) + msvcrt.locking(self.lockfile.fileno(), msvcrt.LK_UNLCK, 1) class _PosixLock(_InterProcessLock): @@ -206,7 +207,6 @@ def synchronized(name, lock_file_prefix, external=False, lock_path=None): local_lock_path = tempfile.mkdtemp() if not os.path.exists(local_lock_path): - cleanup_dir = True fileutils.ensure_tree(local_lock_path) # NOTE(mikal): the lock name cannot contain directory |