From 7254c0a9e33a10247e65f7e8ab22c6bcaa8e835f Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Fri, 23 Nov 2012 04:41:52 +0100 Subject: [PATCH] LUNodeQueryvols: 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 | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index dbc590ad8..8e755651e 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -5346,13 +5346,16 @@ class LUNodeQueryvols(NoHooksLU): def ExpandNames(self): self.share_locks = _ShareAll() - self.needed_locks = {} - if not self.op.nodes: - self.needed_locks[locking.LEVEL_NODE] = locking.ALL_SET + if self.op.nodes: + self.needed_locks = { + locking.LEVEL_NODE: _GetWantedNodes(self, self.op.nodes), + } else: - self.needed_locks[locking.LEVEL_NODE] = \ - _GetWantedNodes(self, self.op.nodes) + 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