From 81cfd8e501835e4658a4fecf81d26ef03d06f214 Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Fri, 23 Nov 2012 04:42:09 +0100 Subject: [PATCH] LUNodeQueryStorage: Use node allocation lock Block instance allocations when all node locks will be acquired. Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: Michele Tartara <mtartara@google.com> --- lib/cmdlib.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index ee8c6ac9d..94a1b9739 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -5386,13 +5386,16 @@ class LUNodeQueryStorage(NoHooksLU): def ExpandNames(self): self.share_locks = _ShareAll() - self.needed_locks = {} if self.op.nodes: - self.needed_locks[locking.LEVEL_NODE] = \ - _GetWantedNodes(self, self.op.nodes) + self.needed_locks = { + locking.LEVEL_NODE: _GetWantedNodes(self, self.op.nodes), + } else: - self.needed_locks[locking.LEVEL_NODE] = locking.ALL_SET + self.needed_locks = { + locking.LEVEL_NODE: locking.ALL_SET, + locking.LEVEL_NODE_ALLOC: locking.ALL_SET, + } def Exec(self, feedback_fn): """Computes the list of nodes and their attributes. -- GitLab