From 350506c61c61cb73749af61810f9cb1ab2ee201b Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Thu, 26 Jul 2012 16:43:18 +0200 Subject: [PATCH] Fix issue in LUClusterVerifyGroup with multi-group clusters In case LUClusterVerifyGroup is run on a group which doesn't contain the master node, the following could happen: - master node is selected due to the explicit check - if the order of nodes in the 'absent_nodes' list is such that the master node is the first in it, then we'll select (again) the master node - passing duplicate nodes to RPC calls will break due to RPC internals; this should be fixed separately, but in the meantime we just refrain from passing such duplicates This patch should not change the semantics of the code, since it wasn't guaranteed even before that we find a vm_capable node. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Bernardo Dal Seno <bdalseno@google.com> --- lib/cmdlib.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 37eee95b0..306f63183 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -3214,10 +3214,12 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors): if master_node not in self.my_node_info: additional_nodes.append(master_node) vf_node_info.append(self.all_node_info[master_node]) - # Add the first vm_capable node we find which is not included + # Add the first vm_capable node we find which is not included, + # excluding the master node (which we already have) for node in absent_nodes: nodeinfo = self.all_node_info[node] - if nodeinfo.vm_capable and not nodeinfo.offline: + if (nodeinfo.vm_capable and not nodeinfo.offline and + node != master_node): additional_nodes.append(node) vf_node_info.append(self.all_node_info[node]) break -- GitLab