From 469f88e1b0dd6f34b6ffdd0d0ab383fdeb0a3ce6 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Thu, 16 Oct 2008 16:26:04 +0000
Subject: [PATCH] Show the cluster parametrs in gnt-cluster info

This is just a raw update without any special formatting.

Reviewed-by: imsnah
---
 lib/cmdlib.py       | 11 +++++++----
 scripts/gnt-cluster | 15 ++++++++++++++-
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 9a1e0bb1d..3e62dd196 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -1865,17 +1865,20 @@ class LUQueryClusterInfo(NoHooksLU):
     """Return cluster config.
 
     """
+    cluster = self.cfg.GetClusterInfo()
     result = {
-      "name": self.cfg.GetClusterName(),
       "software_version": constants.RELEASE_VERSION,
       "protocol_version": constants.PROTOCOL_VERSION,
       "config_version": constants.CONFIG_VERSION,
       "os_api_version": constants.OS_API_VERSION,
       "export_version": constants.EXPORT_VERSION,
-      "master": self.cfg.GetMasterNode(),
       "architecture": (platform.architecture()[0], platform.machine()),
-      "hypervisor_type": self.cfg.GetHypervisorType(),
-      "enabled_hypervisors": self.cfg.GetClusterInfo().enabled_hypervisors,
+      "name": cluster.cluster_name,
+      "master": cluster.master_node,
+      "hypervisor_type": cluster.hypervisor,
+      "enabled_hypervisors": cluster.enabled_hypervisors,
+      "hvparams": cluster.hvparams,
+      "beparams": cluster.beparams,
       }
 
     return result
diff --git a/scripts/gnt-cluster b/scripts/gnt-cluster
index 435e1cb08..b82f7731c 100755
--- a/scripts/gnt-cluster
+++ b/scripts/gnt-cluster
@@ -145,7 +145,20 @@ def ShowClusterConfig(opts, args):
   print ("Architecture (this node): %s (%s)" %
          (result["architecture"][0], result["architecture"][1]))
 
-  print ("Cluster hypervisor: %s" % result["hypervisor_type"])
+  print ("Default hypervisor: %s" % result["hypervisor_type"])
+  print ("Enabled hypervisors: %s" % ", ".join(result["enabled_hypervisors"]))
+
+  print "Hypervisor parameters:"
+  for hv_name, hv_dict in result["hvparams"].items():
+    print "  - %s:" % hv_name
+    for item, val in hv_dict.iteritems():
+      print "      %s: %s" % (item, val)
+
+  print "Cluster parameters:"
+  for gr_name, gr_dict in result["beparams"].items():
+    print "  - %s:" % gr_name
+    for item, val in gr_dict.iteritems():
+      print "      %s: %s" % (item, val)
 
   return 0
 
-- 
GitLab