From 38446261f6eefcc8650b599bd6b6550819af8091 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Mon, 26 Nov 2012 10:09:38 +0100
Subject: [PATCH] LUBackupExport: Use node allocation lock

Block instance allocations when all node locks will be acquired.

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

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 7b6d57133..954032b17 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -14068,6 +14068,11 @@ class LUBackupExport(LogicalUnit):
       #  - removing the removal operation altogether
       self.needed_locks[locking.LEVEL_NODE] = locking.ALL_SET
 
+      # Allocations should be stopped while this LU runs with node locks, but
+      # it doesn't have to be exclusive
+      self.share_locks[locking.LEVEL_NODE_ALLOC] = 1
+      self.needed_locks[locking.LEVEL_NODE_ALLOC] = locking.ALL_SET
+
   def DeclareLocks(self, level):
     """Last minute lock declaration."""
     # All nodes are locked anyway, so nothing to do here.
-- 
GitLab