From 0e67cdbe055551188609dba24b98f9f49dd940fb Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Tue, 2 Dec 2008 05:04:44 +0000 Subject: [PATCH] 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 --- lib/cmdlib.py | 8 ++++++++ scripts/gnt-node | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index acde43dca..c0021093a 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -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: diff --git a/scripts/gnt-node b/scripts/gnt-node index 36ded90b1..1b20a66f8 100755 --- a/scripts/gnt-node +++ b/scripts/gnt-node @@ -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) -- GitLab