From 033d58b0590360498499f2913ece3f32ee88f830 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Wed, 23 Sep 2009 19:01:58 +0200
Subject: [PATCH] Implement uuid in gnt-node/instance list and info

The patch modifies LUQueryInstanceData to return the uuid too and also
adds support for it in the gnt-* scripts.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
---
 lib/cmdlib.py        | 1 +
 scripts/gnt-instance | 3 ++-
 scripts/gnt-node     | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 7463746da..99fba8d56 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -7007,6 +7007,7 @@ class LUQueryInstanceData(NoHooksLU):
         "serial_no": instance.serial_no,
         "mtime": instance.mtime,
         "ctime": instance.ctime,
+        "uuid": instance.uuid,
         }
 
       result[instance.name] = idict
diff --git a/scripts/gnt-instance b/scripts/gnt-instance
index 976be93af..59b1ba85a 100755
--- a/scripts/gnt-instance
+++ b/scripts/gnt-instance
@@ -255,7 +255,7 @@ def ListInstances(opts, args):
       "nic.count": "NICs", "nic.ips": "NIC_IPs",
       "nic.modes": "NIC_modes", "nic.links": "NIC_links",
       "nic.bridges": "NIC_bridges", "nic.macs": "NIC_MACs",
-      "ctime": "CTime", "mtime": "MTime",
+      "ctime": "CTime", "mtime": "MTime", "uuid": "UUID",
       }
   else:
     headers = None
@@ -1088,6 +1088,7 @@ def ShowInstanceConfig(opts, args):
   for instance_name in result:
     instance = result[instance_name]
     buf.write("Instance name: %s\n" % instance["name"])
+    buf.write("UUID: %s\n" % instance["uuid"])
     buf.write("Serial number: %s\n" % instance["serial_no"])
     buf.write("Creation time: %s\n" % utils.FormatTime(instance["ctime"]))
     buf.write("Modification time: %s\n" % utils.FormatTime(instance["mtime"]))
diff --git a/scripts/gnt-node b/scripts/gnt-node
index 3f1bc9ec6..a7334dbeb 100755
--- a/scripts/gnt-node
+++ b/scripts/gnt-node
@@ -56,7 +56,7 @@ _LIST_HEADERS = {
   "master": "IsMaster",
   "offline": "Offline", "drained": "Drained",
   "role": "Role",
-  "ctime": "CTime", "mtime": "MTime",
+  "ctime": "CTime", "mtime": "MTime", "uuid": "UUID"
   }
 
 #: User-facing storage unit types
-- 
GitLab