Add boot id to “gnt-node list”.
authorMichael Hanselmann <hansmi@google.com>
Mon, 8 Oct 2007 15:18:54 +0000 (15:18 +0000)
committerMichael Hanselmann <hansmi@google.com>
Mon, 8 Oct 2007 15:18:54 +0000 (15:18 +0000)
Reviewed-by: iustinp

lib/backend.py
lib/cmdlib.py
scripts/gnt-node

index 396b59d..068f964 100644 (file)
@@ -170,6 +170,12 @@ def GetNodeInfo(vgname):
   if hyp_info is not None:
     outputarray.update(hyp_info)
 
+  f = open("/proc/sys/kernel/random/boot_id", 'r')
+  try:
+    outputarray["bootid"] = f.read(128).rstrip("\n")
+  finally:
+    f.close()
+
   return outputarray
 
 
index cf84943..dff9f73 100644 (file)
@@ -1198,7 +1198,8 @@ class LUQueryNodes(NoHooksLU):
 
     """
     self.dynamic_fields = frozenset(["dtotal", "dfree",
-                                     "mtotal", "mnode", "mfree"])
+                                     "mtotal", "mnode", "mfree",
+                                     "bootid"])
 
     _CheckOutputFields(static=["name", "pinst_cnt", "sinst_cnt",
                                "pinst_list", "sinst_list",
@@ -1229,6 +1230,7 @@ class LUQueryNodes(NoHooksLU):
             "mfree": utils.TryConvert(int, nodeinfo['memory_free']),
             "dtotal": utils.TryConvert(int, nodeinfo['vg_size']),
             "dfree": utils.TryConvert(int, nodeinfo['vg_free']),
+            "bootid": nodeinfo['bootid'],
             }
         else:
           live_data[name] = {}
index e32d456..a22c2d8 100755 (executable)
@@ -58,7 +58,8 @@ def ListNodes(opts, args):
                "pinst_list": "PriInstances", "sinst_list": "SecInstances",
                "pip": "PrimaryIP", "sip": "SecondaryIP",
                "dtotal": "DTotal", "dfree": "DFree",
-               "mtotal": "MTotal", "mnode": "MNode", "mfree": "MFree"}
+               "mtotal": "MTotal", "mnode": "MNode", "mfree": "MFree",
+               "bootid": "BootID"}
   else:
     headers = None