Commit 2fa74ef4 authored by Iustin Pop's avatar Iustin Pop
Browse files

Convert all_instances_info rpc to new result style

Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarGuido Trotter <>
parent 7ad1af4a
......@@ -695,11 +695,11 @@ def GetAllInstancesInfo(hypervisor_list):
# invocations of the different hypervisors
for key in 'memory', 'vcpus':
if value[key] != output[name][key]:
raise errors.HypervisorError("Instance %s is running twice"
" with different parameters" % name)
_Fail("Instance %s is running twice"
" with different parameters", name)
output[name] = value
return output
return True, output
def InstanceOsAdd(instance, reinstall):
......@@ -3446,11 +3446,11 @@ class LUQueryInstances(NoHooksLU):
if result.offline:
# offline nodes will be in both lists
if result.failed:
if result.failed or result.RemoteFailMsg():
if result.payload:
# else no instance is alive
live_data = dict([(name, {}) for name in instance_names])
......@@ -6914,6 +6914,10 @@ class IAllocator(object):
if not isinstance(, dict):
raise errors.OpExecError("Can't get data for node %s" % nname)
msg = node_iinfo[nname].RemoteFailMsg()
if msg:
raise errors.OpExecError("Can't get node instance info"
" from node %s: %s" % (nname, msg))
remote_info =
for attr in ['memory_total', 'memory_free', 'memory_dom0',
'vg_size', 'vg_free', 'cpu_total']:
......@@ -6930,10 +6934,10 @@ class IAllocator(object):
for iinfo, beinfo in i_list:
if iinfo.primary_node == nname:
i_p_mem += beinfo[constants.BE_MEMORY]
if not in node_iinfo[nname].data:
if not in node_iinfo[nname].payload:
i_used_mem = 0
i_used_mem = int(node_iinfo[nname].data[]['memory'])
i_used_mem = int(node_iinfo[nname].payload[]['memory'])
i_mem_diff = beinfo[constants.BE_MEMORY] - i_used_mem
remote_info['memory_free'] -= max(0, i_mem_diff)
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