From 9cbfc69ad355f4abefddb30142d11693313c5981 Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Fri, 23 Nov 2012 04:40:17 +0100 Subject: [PATCH] LUClusterRepairDiskSizes: Use node allocation lock This opcode acquires all node resource locks, which conflicts with instance allocations. Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: Helga Velroyen <helgav@google.com> --- lib/cmdlib.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index a795c4f75..3f80ae509 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -3797,6 +3797,8 @@ class LUClusterRepairDiskSizes(NoHooksLU): def ExpandNames(self): if self.op.instances: self.wanted_names = _GetWantedInstances(self, self.op.instances) + # Not getting the node allocation lock as only a specific set of + # instances (and their nodes) is going to be acquired self.needed_locks = { locking.LEVEL_NODE_RES: [], locking.LEVEL_INSTANCE: self.wanted_names, @@ -3807,10 +3809,15 @@ class LUClusterRepairDiskSizes(NoHooksLU): self.needed_locks = { locking.LEVEL_NODE_RES: locking.ALL_SET, locking.LEVEL_INSTANCE: locking.ALL_SET, + + # This opcode is acquires the node locks for all instances + locking.LEVEL_NODE_ALLOC: locking.ALL_SET, } + self.share_locks = { locking.LEVEL_NODE_RES: 1, locking.LEVEL_INSTANCE: 0, + locking.LEVEL_NODE_ALLOC: 1, } def DeclareLocks(self, level): -- GitLab