Commit 59322403 authored by Iustin Pop's avatar Iustin Pop
Browse files

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
parent 5fcdc80d
...@@ -1468,6 +1468,7 @@ class LUQueryClusterInfo(NoHooksLU): ...@@ -1468,6 +1468,7 @@ class LUQueryClusterInfo(NoHooksLU):
""" """
_OP_REQP = [] _OP_REQP = []
REQ_MASTER = False
def CheckPrereq(self): def CheckPrereq(self):
"""No prerequsites needed for this LU. """No prerequsites needed for this LU.
...@@ -1479,8 +1480,6 @@ class LUQueryClusterInfo(NoHooksLU): ...@@ -1479,8 +1480,6 @@ class LUQueryClusterInfo(NoHooksLU):
"""Return cluster config. """Return cluster config.
""" """
instances = [self.cfg.GetInstanceInfo(name)
for name in self.cfg.GetInstanceList()]
result = { result = {
"name": self.sstore.GetClusterName(), "name": self.sstore.GetClusterName(),
"software_version": constants.RELEASE_VERSION, "software_version": constants.RELEASE_VERSION,
...@@ -1490,9 +1489,6 @@ class LUQueryClusterInfo(NoHooksLU): ...@@ -1490,9 +1489,6 @@ class LUQueryClusterInfo(NoHooksLU):
"export_version": constants.EXPORT_VERSION, "export_version": constants.EXPORT_VERSION,
"master": self.sstore.GetMasterNode(), "master": self.sstore.GetMasterNode(),
"architecture": (platform.architecture()[0], platform.machine()), "architecture": (platform.architecture()[0], platform.machine()),
"instances": [(instance.name, instance.primary_node)
for instance in instances],
"nodes": self.cfg.GetNodeList(),
} }
return result return result
......
...@@ -102,17 +102,10 @@ def ShowClusterConfig(opts, args): ...@@ -102,17 +102,10 @@ def ShowClusterConfig(opts, args):
print ("Cluster name: %s" % result["name"]) print ("Cluster name: %s" % result["name"])
print ("Architecture: %s (%s)" %
(result["architecture"][0], result["architecture"][1]))
print ("Master node: %s" % result["master"]) print ("Master node: %s" % result["master"])
print ("Instances:") print ("Architecture (this node): %s (%s)" %
for name, node in result["instances"]: (result["architecture"][0], result["architecture"][1]))
print (" - %s (on %s)" % (name, node))
print ("Nodes:")
for name in result["nodes"]:
print (" - %s" % name)
return 0 return 0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment