LUOobCommand: Use node allocation lock
authorMichael Hanselmann <hansmi@google.com>
Fri, 23 Nov 2012 03:41:34 +0000 (04:41 +0100)
committerMichael Hanselmann <hansmi@google.com>
Fri, 7 Dec 2012 12:32:49 +0000 (13:32 +0100)
If no node names are given, all node locks are acquired.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

lib/cmdlib.py

index 75dfab5..dbc590a 100644 (file)
@@ -4814,6 +4814,11 @@ class LUOobCommand(NoHooksLU):
       locking.LEVEL_NODE: lock_names,
       }
 
+    if not self.op.node_names:
+      # Acquire node allocation lock only if all nodes are affected
+      self.needed_locks[locking.LEVEL_NODE_ALLOC] = locking.ALL_SET
+      self.share_locks[locking.LEVEL_NODE_ALLOC] = 1
+
   def CheckPrereq(self):
     """Check prerequisites.