Commit c120ff34 authored by Iustin Pop's avatar Iustin Pop

Add a new node list field

This patch adds a ‘role’ node list field, which shows a one-character
node status. This is a simpler way to see the node status than selecting
all the flags individually.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 81b59aaf
......@@ -1878,6 +1878,7 @@ class LUQueryNodes(NoHooksLU):
"master",
"offline",
"drained",
"role",
)
def ExpandNames(self):
......@@ -2006,6 +2007,17 @@ class LUQueryNodes(NoHooksLU):
val = node.drained
elif self._FIELDS_DYNAMIC.Matches(field):
val = live_data[node.name].get(field, None)
elif field == "role":
if node.name == master_node:
val = "M"
elif node.master_candidate:
val = "C"
elif node.drained:
val = "D"
elif node.offline:
val = "O"
else:
val = "R"
else:
raise errors.ParameterError(field)
node_output.append(val)
......
......@@ -423,6 +423,38 @@
<simpara>whether the node is offline or not</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>role</term>
<listitem>
<para>
A condensed version of the node flags; this field will
output a one-character field, with the following
possible values:
<itemizedlist>
<listitem>
<simpara><emphasis>M</emphasis> for the master
node</simpara>
</listitem>
<listitem>
<simpara><emphasis>C</emphasis> for a master
candidate</simpara>
</listitem>
<listitem>
<simpara><emphasis>R</emphasis> for a regular
node</simpara>
</listitem>
<listitem>
<simpara><emphasis>D</emphasis> for a drained
node</simpara>
</listitem>
<listitem>
<simpara><emphasis>O</emphasis> for an offline
node</simpara>
</listitem>
</itemizedlist>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
......
......@@ -56,6 +56,7 @@ _LIST_HEADERS = {
"master_candidate": "MasterC",
"master": "IsMaster",
"offline": "Offline", "drained": "Drained",
"role": "Role",
}
......
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