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

Fix errors when the node info RPC is incomplete

[Forward-port from the 1.2 branch]

If ganeti starts before xend, the node information will not have all the
fields filled in. The patch changes so that missing keys will be treated
as unknown (this applies to other cases as well, not only xend not

Reviewed-by: ultrotter
parent 028c6b76
......@@ -1604,14 +1604,15 @@ class LUQueryNodes(NoHooksLU):
for name in nodenames:
nodeinfo = node_data.get(name, None)
if nodeinfo:
fn = utils.TryConvert
live_data[name] = {
"mtotal": utils.TryConvert(int, nodeinfo['memory_total']),
"mnode": utils.TryConvert(int, nodeinfo['memory_dom0']),
"mfree": utils.TryConvert(int, nodeinfo['memory_free']),
"dtotal": utils.TryConvert(int, nodeinfo['vg_size']),
"dfree": utils.TryConvert(int, nodeinfo['vg_free']),
"ctotal": utils.TryConvert(int, nodeinfo['cpu_total']),
"bootid": nodeinfo['bootid'],
"mtotal": fn(int, nodeinfo.get('memory_total', None)),
"mnode": fn(int, nodeinfo.get('memory_dom0', None)),
"mfree": fn(int, nodeinfo.get('memory_free', None)),
"dtotal": fn(int, nodeinfo.get('vg_size', None)),
"dfree": fn(int, nodeinfo.get('vg_free', None)),
"ctotal": fn(int, nodeinfo.get('cpu_total', None)),
"bootid": nodeinfo.get('bootid', None),
live_data[name] = {}
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