Skip to content
Snippets Groups Projects
Commit b30d95b6 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

locking: Implement priority in Ganeti lock manager


Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent 7100c2fa
No related branches found
No related tags found
No related merge requests found
......@@ -1452,7 +1452,7 @@ class GanetiLockManager:
"""
return level == LEVEL_CLUSTER and (names is None or BGL in names)
def acquire(self, level, names, timeout=None, shared=0):
def acquire(self, level, names, timeout=None, shared=0, priority=None):
"""Acquire a set of resource locks, at the same level.
@type level: member of locking.LEVELS
......@@ -1465,6 +1465,8 @@ class GanetiLockManager:
an exclusive lock will be acquired
@type timeout: float
@param timeout: Maximum time to acquire all locks
@type priority: integer
@param priority: Priority for acquiring lock
"""
assert level in LEVELS, "Invalid locking level %s" % level
......@@ -1483,7 +1485,8 @@ class GanetiLockManager:
" while owning some at a greater one")
# Acquire the locks in the set.
return self.__keyring[level].acquire(names, shared=shared, timeout=timeout)
return self.__keyring[level].acquire(names, shared=shared, timeout=timeout,
priority=priority)
def release(self, level, names=None):
"""Release a set of resource locks, at the same level.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment