Commit 07db7ed2 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Add opportunistic locking to GanetiLockManager



Just forwarding the parameter, nothing more.
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent a95c53ea
......@@ -1751,7 +1751,8 @@ class GanetiLockManager:
"""
return level == LEVEL_CLUSTER and (names is None or BGL in names)
def acquire(self, level, names, timeout=None, shared=0, priority=None):
def acquire(self, level, names, timeout=None, shared=0, priority=None,
opportunistic=False):
"""Acquire a set of resource locks, at the same level.
@type level: member of locking.LEVELS
......@@ -1766,6 +1767,9 @@ class GanetiLockManager:
@param timeout: Maximum time to acquire all locks
@type priority: integer
@param priority: Priority for acquiring lock
@type opportunistic: boolean
@param opportunistic: Acquire locks opportunistically; use the return value
to determine which locks were actually acquired
"""
assert level in LEVELS, "Invalid locking level %s" % level
......@@ -1785,7 +1789,8 @@ class GanetiLockManager:
# Acquire the locks in the set.
return self.__keyring[level].acquire(names, shared=shared, timeout=timeout,
priority=priority)
priority=priority,
opportunistic=opportunistic)
def downgrade(self, level, names=None):
"""Downgrade a set of resource locks from exclusive to shared mode.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment