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

Add group, group.uuid fields in node list



This is needed to at least see the current group configuration.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent e90739d6
......@@ -77,6 +77,7 @@ _LIST_HEADERS = {
"role": "Role",
"ctime": "CTime", "mtime": "MTime", "uuid": "UUID",
"master_capable": "MasterCapable", "vm_capable": "VMCapable",
"group": "Group", "group.uuid": "GroupUUID",
}
......
......@@ -3361,8 +3361,9 @@ class LUQueryNodes(NoHooksLU):
"pinst_cnt", "sinst_cnt",
"pinst_list", "sinst_list",
"pip", "sip", "tags",
"master",
"role"] + _SIMPLE_FIELDS
"master", "role",
"group.uuid", "group",
] + _SIMPLE_FIELDS
)
def CheckArguments(self):
......@@ -3404,6 +3405,11 @@ class LUQueryNodes(NoHooksLU):
nodenames = utils.NiceSort(nodenames)
nodelist = [all_info[name] for name in nodenames]
if "group" in self.op.output_fields:
groups = self.cfg.GetAllNodeGroupsInfo()
else:
groups = {}
# begin data gathering
if self.do_node_query:
......@@ -3485,6 +3491,14 @@ class LUQueryNodes(NoHooksLU):
val = "O"
else:
val = "R"
elif field == "group.uuid":
val = node.group
elif field == "group":
ng = groups.get(node.group, None)
if ng is None:
val = "<unknown>"
else:
val = ng.name
else:
raise errors.ParameterError(field)
node_output.append(val)
......
......@@ -545,6 +545,20 @@
<para>whether the node can host instances</para>
</listitem>
</varlistentry>
<varlistentry>
<term>group</term>
<listitem>
<para>the name of the node's group, if known (the query
is done without locking, so data consistency is not
guaranteed)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>group.uuid</term>
<listitem>
<para>the UUID of the node's group</para>
</listitem>
</varlistentry>
</variablelist>
</para>
......
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