Verify: Add and populate node_info dict
authorGuido Trotter <ultrotter@google.com>
Thu, 10 Apr 2008 17:03:29 +0000 (17:03 +0000)
committerGuido Trotter <ultrotter@google.com>
Thu, 10 Apr 2008 17:03:29 +0000 (17:03 +0000)
During information gathering we collect information from call_node_info, and
then when we cycle trough the nodes add it into a node_info dict containing a
node's free memory and disk. This will be useful later to verify that the
cluster is N+1 redundant. The disk space is saved as well because it can be
useful for checks about disk space redundancy.

Reviewed-by: iustinp

lib/cmdlib.py

index dbeef5d..3399b2c 100644 (file)
@@ -767,6 +767,7 @@ class LUVerifyCluster(NoHooksLU):
     instancelist = utils.NiceSort(self.cfg.GetInstanceList())
     node_volume = {}
     node_instance = {}
+    node_info = {}
 
     # FIXME: verify OS list
     # do local checksums
@@ -786,6 +787,7 @@ class LUVerifyCluster(NoHooksLU):
       }
     all_nvinfo = rpc.call_node_verify(nodelist, node_verify_param)
     all_rversion = rpc.call_version(nodelist)
+    all_ninfo = rpc.call_node_info(nodelist, self.cfg.GetVGName())
 
     for node in nodelist:
       feedback_fn("* Verifying node %s" % node)
@@ -818,6 +820,23 @@ class LUVerifyCluster(NoHooksLU):
 
       node_instance[node] = nodeinstance
 
+      # node_info
+      nodeinfo = all_ninfo[node]
+      if not isinstance(nodeinfo, dict):
+        feedback_fn("  - ERROR: connection to %s failed" % (node,))
+        bad = True
+        continue
+
+      try:
+        node_info[node] = {
+          "mfree": int(nodeinfo['memory_free']),
+          "dfree": int(nodeinfo['vg_free']),
+        }
+      except ValueError:
+        feedback_fn("  - ERROR: invalid value returned from node %s" % (node,))
+        bad = True
+        continue
+
     node_vol_should = {}
 
     for instance in instancelist: