From 3924700f067655084ffcea8d3d5821f532c79337 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Tue, 14 Oct 2008 14:42:31 +0000 Subject: [PATCH] Use the auto_balance in cluster verify This patch changes the cluster verify in two ways: - do not use instances marked with auto_balance=False in N+1 memory checks - report, if any, the number of instances with auto_balance=False Forward port from rev 1562 on the 1.2 branch. Reviewed-by: ultrotter --- lib/cmdlib.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 8b31fd6c4..b4dcda2ca 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -691,7 +691,8 @@ class LUVerifyCluster(LogicalUnit): needed_mem = 0 for instance in instances: bep = self.cfg.GetClusterInfo().FillBE(instance_cfg[instance]) - needed_mem += bep[constants.BE_MEMORY] + if bep[constants.BE_AUTOBALANCE]: + needed_mem += bep[constants.BE_MEMORY] if nodeinfo['mfree'] < needed_mem: feedback_fn(" - ERROR: not enough memory on node %s to accomodate" " failovers should node %s fail" % (node, prinode)) @@ -736,6 +737,7 @@ class LUVerifyCluster(LogicalUnit): nodeinfo = [self.cfg.GetNodeInfo(nname) for nname in nodelist] instancelist = utils.NiceSort(self.cfg.GetInstanceList()) i_non_redundant = [] # Non redundant instances + i_non_a_balanced = [] # Non auto-balanced instances node_volume = {} node_instance = {} node_info = {} @@ -765,6 +767,7 @@ class LUVerifyCluster(LogicalUnit): all_ninfo = self.rpc.call_node_info(nodelist, self.cfg.GetVGName(), self.cfg.GetHypervisorType()) + cluster = self.cfg.GetClusterInfo() for node in nodelist: feedback_fn("* Verifying node %s" % node) result = self._VerifyNode(node, file_names, local_checksums, @@ -854,6 +857,9 @@ class LUVerifyCluster(LogicalUnit): feedback_fn(" - WARNING: multiple secondaries for instance %s" % instance) + if not cluster.FillBE(inst_config)[constants.BE_AUTOBALANCE]: + i_non_a_balanced.append(instance) + for snode in inst_config.secondary_nodes: if snode in node_info: node_info[snode]['sinst'].append(instance) @@ -884,6 +890,10 @@ class LUVerifyCluster(LogicalUnit): feedback_fn(" - NOTICE: %d non-redundant instance(s) found." % len(i_non_redundant)) + if i_non_a_balanced: + feedback_fn(" - NOTICE: %d non-auto-balanced instance(s) found." + % len(i_non_a_balanced)) + return not bad def HooksCallBack(self, phase, hooks_results, feedback_fn, lu_result): -- GitLab