From a0150c51956bfd7d0851fd5944d4485810ad64cf Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Thu, 22 Nov 2012 23:29:07 +0100
Subject: [PATCH] Acquire node allocation lock during node query

If locking is used (usually by ganeti-watcher), node allocations must be
temporarily blocked.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
---
 lib/cmdlib.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 056f21eff..cfb708b60 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -5227,6 +5227,7 @@ class _NodeQuery(_QueryBase):
     if self.do_locking:
       # If any non-static field is requested we need to lock the nodes
       lu.needed_locks[locking.LEVEL_NODE] = self.wanted
+      lu.needed_locks[locking.LEVEL_NODE_ALLOC] = locking.ALL_SET
 
   def DeclareLocks(self, lu, level):
     pass
-- 
GitLab