From: Guido Trotter Date: Thu, 10 Apr 2008 17:03:46 +0000 (+0000) Subject: Verify: add more instance information to node_info X-Git-Tag: v2.0.0alpha0~543 X-Git-Url: https://code.grnet.gr/git/ganeti-local/commitdiff_plain/36e7da506f31d5a71bcc4bb9f175e79ab96e68e3 Verify: add more instance information to node_info The sisnt-by-pnode field contains all secondary instances of a node, grouped by their primary node. This information allows us to see quickly if when a node dies some of its instances cannot be started on their secondary node. Reviewed-by: iustinp --- diff --git a/lib/cmdlib.py b/lib/cmdlib.py index dbfc83a..f43a110 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -834,6 +834,13 @@ class LUVerifyCluster(NoHooksLU): "dfree": int(nodeinfo['vg_free']), "pinst": [], "sinst": [], + # dictionary holding all instances this node is secondary for, + # grouped by their primary node. Each key is a cluster node, and each + # value is a list of instances which have the key as primary and the + # current node as secondary. this is handy to calculate N+1 memory + # availability if you can only failover from a primary to its + # secondary. + "sinst-by-pnode": {}, } except ValueError: feedback_fn(" - ERROR: invalid value returned from node %s" % (node,)) @@ -873,6 +880,9 @@ class LUVerifyCluster(NoHooksLU): for snode in inst_config.secondary_nodes: if snode in node_info: node_info[snode]['sinst'].append(instance) + if pnode not in node_info[snode]['sinst-by-pnode']: + node_info[snode]['sinst-by-pnode'][pnode] = [] + node_info[snode]['sinst-by-pnode'][pnode].append(instance) else: feedback_fn(" - ERROR: instance %s, connection to secondary node" " %s failed" % (instance, snode))