Commit 0e67cdbe authored by Iustin Pop's avatar Iustin Pop
Browse files

Add master/master_candidate fields to node list

This patch adds listing of the master_candidate field (as Y/N) and of
the master role (again Y/N) for nodes.

Reviewed-by: imsnah
parent 8b8b8b81
......@@ -1547,6 +1547,8 @@ class LUQueryNodes(NoHooksLU):
"pinst_list", "sinst_list",
"pip", "sip", "tags",
"serial_no",
"master_candidate",
"master",
)
def ExpandNames(self):
......@@ -1635,6 +1637,8 @@ class LUQueryNodes(NoHooksLU):
if secnode in node_to_secondary:
node_to_secondary[secnode].add(inst.name)
master_node = self.cfg.GetMasterNode()
# end data gathering
output = []
......@@ -1659,6 +1663,10 @@ class LUQueryNodes(NoHooksLU):
val = list(node.GetTags())
elif field == "serial_no":
val = node.serial_no
elif field == "master_candidate":
val = node.master_candidate
elif field == "master":
val = node.name == master_node
elif self._FIELDS_DYNAMIC.Matches(field):
val = live_data[node.name].get(field, None)
else:
......
......@@ -115,6 +115,8 @@ def ListNodes(opts, args):
"ctotal": "CTotal",
"tags": "Tags",
"serial_no": "SerialNo",
"master_candidate": "MasterC",
"master": "IsMaster",
}
else:
headers = None
......@@ -133,6 +135,11 @@ def ListNodes(opts, args):
val = row[idx]
if field in list_type_fields:
val = ",".join(val)
elif field in ('master', 'master_candidate'):
if val:
val = 'Y'
else:
val = 'N'
elif val is None:
val = "?"
row[idx] = str(val)
......
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