Commit 3924700f authored by Iustin Pop's avatar Iustin Pop
Browse files

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
parent c1f1cbb2
......@@ -691,6 +691,7 @@ class LUVerifyCluster(LogicalUnit):
needed_mem = 0
for instance in instances:
bep = self.cfg.GetClusterInfo().FillBE(instance_cfg[instance])
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"
......@@ -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):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment