Commit b288b6f3 authored by René Nussbaumer's avatar René Nussbaumer
Browse files

List node parameters in gnt-group list


Signed-off-by: default avatarRené Nussbaumer <rn@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarAdeodato Simo <dato@google.com>
parent 8572f1fe
......@@ -31,7 +31,7 @@ from ganeti import utils
#: default list of fields for L{ListGroups}
_LIST_DEF_FIELDS = ["name", "node_cnt", "pinst_cnt", "alloc_policy"]
_LIST_DEF_FIELDS = ["name", "node_cnt", "pinst_cnt", "alloc_policy", "ndparams"]
def AddGroup(opts, args):
......@@ -68,6 +68,20 @@ def AssignNodes(opts, args):
SubmitOpCode(op, opts=opts)
def _FmtDict(data):
"""Format dict data into command-line format.
@param data: The input dict to be formatted
@return: The formatted dict
"""
if not data:
return "(empty)"
return utils.CommaJoin(["%s=%s" % (key, value)
for key, value in data.items()])
def ListGroups(opts, args):
"""List node groups and their properties.
......@@ -79,7 +93,11 @@ def ListGroups(opts, args):
"""
desired_fields = ParseFields(opts.output, _LIST_DEF_FIELDS)
fmtoverride = dict.fromkeys(["node_list", "pinst_list"], (",".join, False))
fmtoverride = {
"node_list": (",".join, False),
"pinst_list": (",".join, False),
"ndparams": (_FmtDict, False),
}
return GenericList(constants.QR_GROUP, desired_fields, args, None,
opts.separator, not opts.no_headers,
......
......@@ -1157,6 +1157,7 @@ _GROUP_SIMPLE_FIELDS = {
"name": ("Group", constants.QFT_TEXT),
"serial_no": ("SerialNo", constants.QFT_NUMBER),
"uuid": ("UUID", constants.QFT_TEXT),
"ndparams": ("NDParams", constants.QFT_OTHER),
}
......
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