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

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 <>
Reviewed-by: default avatarGuido Trotter <>
parent 81b59aaf
...@@ -1878,6 +1878,7 @@ class LUQueryNodes(NoHooksLU): ...@@ -1878,6 +1878,7 @@ class LUQueryNodes(NoHooksLU):
"master", "master",
"offline", "offline",
"drained", "drained",
) )
def ExpandNames(self): def ExpandNames(self):
...@@ -2006,6 +2007,17 @@ class LUQueryNodes(NoHooksLU): ...@@ -2006,6 +2007,17 @@ class LUQueryNodes(NoHooksLU):
val = node.drained val = node.drained
elif self._FIELDS_DYNAMIC.Matches(field): elif self._FIELDS_DYNAMIC.Matches(field):
val = live_data[].get(field, None) val = live_data[].get(field, None)
elif field == "role":
if == master_node:
val = "M"
elif node.master_candidate:
val = "C"
elif node.drained:
val = "D"
elif node.offline:
val = "O"
val = "R"
else: else:
raise errors.ParameterError(field) raise errors.ParameterError(field)
node_output.append(val) node_output.append(val)
...@@ -423,6 +423,38 @@ ...@@ -423,6 +423,38 @@
<simpara>whether the node is offline or not</simpara> <simpara>whether the node is offline or not</simpara>
</listitem> </listitem>
</varlistentry> </varlistentry>
A condensed version of the node flags; this field will
output a one-character field, with the following
possible values:
<simpara><emphasis>M</emphasis> for the master
<simpara><emphasis>C</emphasis> for a master
<simpara><emphasis>R</emphasis> for a regular
<simpara><emphasis>D</emphasis> for a drained
<simpara><emphasis>O</emphasis> for an offline
</variablelist> </variablelist>
</para> </para>
...@@ -56,6 +56,7 @@ _LIST_HEADERS = { ...@@ -56,6 +56,7 @@ _LIST_HEADERS = {
"master_candidate": "MasterC", "master_candidate": "MasterC",
"master": "IsMaster", "master": "IsMaster",
"offline": "Offline", "drained": "Drained", "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