From 07db7ed2a38459cae8ad00683aa916c1a68e55cd Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Thu, 22 Nov 2012 18:44:33 +0100
Subject: [PATCH] Add opportunistic locking to GanetiLockManager

Just forwarding the parameter, nothing more.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 lib/locking.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/locking.py b/lib/locking.py
index b0b4758b6..eb96a709e 100644
--- a/lib/locking.py
+++ b/lib/locking.py
@@ -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.
-- 
GitLab