From 593224035f548b41dd048f71a126c55f76f847ed Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Fri, 27 Jul 2007 08:15:21 +0000
Subject: [PATCH] Fix the "gnt-cluster getmaster" command by making the
 LuQueryClusterInfo runnable on non-master nodes (and remove the list of
 instances and nodes returned by it, that information can be retrieved by
 other opcodes).

Also, remove the node/instance list from "gnt-cluster info" as it
doesn't make sense to duplicate this information.

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

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index fa254326a..366e646bf 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -1468,6 +1468,7 @@ class LUQueryClusterInfo(NoHooksLU):
 
   """
   _OP_REQP = []
+  REQ_MASTER = False
 
   def CheckPrereq(self):
     """No prerequsites needed for this LU.
@@ -1479,8 +1480,6 @@ class LUQueryClusterInfo(NoHooksLU):
     """Return cluster config.
 
     """
-    instances = [self.cfg.GetInstanceInfo(name)
-                 for name in self.cfg.GetInstanceList()]
     result = {
       "name": self.sstore.GetClusterName(),
       "software_version": constants.RELEASE_VERSION,
@@ -1490,9 +1489,6 @@ class LUQueryClusterInfo(NoHooksLU):
       "export_version": constants.EXPORT_VERSION,
       "master": self.sstore.GetMasterNode(),
       "architecture": (platform.architecture()[0], platform.machine()),
-      "instances": [(instance.name, instance.primary_node)
-                    for instance in instances],
-      "nodes": self.cfg.GetNodeList(),
       }
 
     return result
diff --git a/scripts/gnt-cluster b/scripts/gnt-cluster
index 3fd271cef..6c9a970bb 100755
--- a/scripts/gnt-cluster
+++ b/scripts/gnt-cluster
@@ -102,17 +102,10 @@ def ShowClusterConfig(opts, args):
 
   print ("Cluster name: %s" % result["name"])
 
-  print ("Architecture: %s (%s)" %
-            (result["architecture"][0], result["architecture"][1]))
-
   print ("Master node: %s" % result["master"])
 
-  print ("Instances:")
-  for name, node in result["instances"]:
-    print ("  - %s (on %s)" % (name, node))
-  print ("Nodes:")
-  for name in result["nodes"]:
-    print ("  - %s" % name)
+  print ("Architecture (this node): %s (%s)" %
+         (result["architecture"][0], result["architecture"][1]))
 
   return 0
 
-- 
GitLab