Commit c0f2b229 authored by Iustin Pop's avatar Iustin Pop
Browse files

Some fixes related to auto_balance

Change the constant name to match the value (autobalance ->
auto_balance).

Also add the auto_balance header so that gnt-instance can list it.

Reviewed-by: ultrotter
parent 647a5d80
......@@ -691,7 +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]:
if bep[constants.BE_AUTO_BALANCE]:
needed_mem += bep[constants.BE_MEMORY]
if nodeinfo['mfree'] < needed_mem:
feedback_fn(" - ERROR: not enough memory on node %s to accomodate"
......@@ -857,7 +857,7 @@ class LUVerifyCluster(LogicalUnit):
feedback_fn(" - WARNING: multiple secondaries for instance %s"
% instance)
if not cluster.FillBE(inst_config)[constants.BE_AUTOBALANCE]:
if not cluster.FillBE(inst_config)[constants.BE_AUTO_BALANCE]:
i_non_a_balanced.append(instance)
for snode in inst_config.secondary_nodes:
......@@ -4625,8 +4625,8 @@ class LUSetInstanceParams(LogicalUnit):
if constants.BE_MEMORY in self.op.beparams and not self.force:
mem_check_list = [pnode]
if be_new[constants.BE_AUTOBALANCE]:
# either we changed autobalance to yes or it was from before
if be_new[constants.BE_AUTO_BALANCE]:
# either we changed auto_balance to yes or it was from before
mem_check_list.extend(instance.secondary_nodes)
instance_info = self.rpc.call_instance_info(pnode, instance.name,
instance.hypervisor)
......@@ -4651,7 +4651,7 @@ class LUSetInstanceParams(LogicalUnit):
" from starting, due to %d MB of memory"
" missing on its primary node" % miss_mem)
if be_new[constants.BE_AUTOBALANCE]:
if be_new[constants.BE_AUTO_BALANCE]:
for node in instance.secondary_nodes:
if node not in nodeinfo or not isinstance(nodeinfo[node], dict):
self.warn.append("Can't get info from secondary node %s" % node)
......
......@@ -278,12 +278,12 @@ HVS_PARAMETERS = frozenset([
# BE parameter names
BE_MEMORY = "memory"
BE_VCPUS = "vcpus"
BE_AUTOBALANCE = "auto_balance"
BE_AUTO_BALANCE = "auto_balance"
BES_PARAMETERS = frozenset([
BE_MEMORY,
BE_VCPUS,
BE_AUTOBALANCE,
BE_AUTO_BALANCE,
])
# BE GROUP
......
......@@ -201,6 +201,7 @@ def ListInstances(opts, args):
"hvparams": "Hypervisor_parameters",
"be/memory": "Configured_memory",
"be/vcpus": "VCPUs",
"be/auto_balance": "Auto_balance",
}
else:
headers = None
......
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