From 71aa8f737b86a86ea2e2b34418d7f42f1478f69d Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Tue, 8 Jan 2008 11:03:49 +0000
Subject: [PATCH] =?UTF-8?q?Make=20=E2=80=98gnt-instance=20info=E2=80=99=20?=
 =?UTF-8?q?show=20kernel/initrd=20paths?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This patch changes the info subcommand to nicely show the kernel and
initrd paths.

Reviewed-by: imsnah
---
 lib/cmdlib.py        |  2 ++
 scripts/gnt-instance | 12 ++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index bb368bb12..8d5bf9c08 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -4054,6 +4054,8 @@ class LUQueryInstanceData(NoHooksLU):
         "disks": disks,
         "network_port": instance.network_port,
         "vcpus": instance.vcpus,
+        "kernel_path": instance.kernel_path,
+        "initrd_path": instance.initrd_path,
         }
 
       result[instance.name] = idict
diff --git a/scripts/gnt-instance b/scripts/gnt-instance
index be32e9906..f230714f0 100755
--- a/scripts/gnt-instance
+++ b/scripts/gnt-instance
@@ -626,6 +626,18 @@ def ShowInstanceConfig(opts, args):
     buf.write("    - secondaries: %s\n" % ", ".join(instance["snodes"]))
     buf.write("  Operating system: %s\n" % instance["os"])
     buf.write("  Allocated network port: %s\n" % instance["network_port"])
+    if instance["kernel_path"] in (None, constants.VALUE_DEFAULT):
+      kpath = "(default: %s)" % constants.XEN_KERNEL
+    else:
+      kpath = instance["kernel_path"]
+    buf.write("  Kernel path: %s\n" % kpath)
+    if instance["initrd_path"] in (None, constants.VALUE_DEFAULT):
+      initrd = "(default: %s)" % constants.XEN_INITRD
+    elif instance["initrd_path"] == constants.VALUE_NONE:
+      initrd = "(none)"
+    else:
+      initrd = instance["initrd_path"]
+    buf.write("       initrd: %s\n" % initrd)
     buf.write("  Hardware:\n")
     buf.write("    - VCPUs: %d\n" % instance["vcpus"])
     buf.write("    - memory: %dMiB\n" % instance["memory"])
-- 
GitLab