Revision b288b6f3 lib/client/gnt_group.py
b/lib/client/gnt_group.py | ||
---|---|---|
31 | 31 |
|
32 | 32 |
|
33 | 33 |
#: default list of fields for L{ListGroups} |
34 |
_LIST_DEF_FIELDS = ["name", "node_cnt", "pinst_cnt", "alloc_policy"] |
|
34 |
_LIST_DEF_FIELDS = ["name", "node_cnt", "pinst_cnt", "alloc_policy", "ndparams"]
|
|
35 | 35 |
|
36 | 36 |
|
37 | 37 |
def AddGroup(opts, args): |
... | ... | |
68 | 68 |
SubmitOpCode(op, opts=opts) |
69 | 69 |
|
70 | 70 |
|
71 |
def _FmtDict(data): |
|
72 |
"""Format dict data into command-line format. |
|
73 |
|
|
74 |
@param data: The input dict to be formatted |
|
75 |
@return: The formatted dict |
|
76 |
|
|
77 |
""" |
|
78 |
if not data: |
|
79 |
return "(empty)" |
|
80 |
|
|
81 |
return utils.CommaJoin(["%s=%s" % (key, value) |
|
82 |
for key, value in data.items()]) |
|
83 |
|
|
84 |
|
|
71 | 85 |
def ListGroups(opts, args): |
72 | 86 |
"""List node groups and their properties. |
73 | 87 |
|
... | ... | |
79 | 93 |
|
80 | 94 |
""" |
81 | 95 |
desired_fields = ParseFields(opts.output, _LIST_DEF_FIELDS) |
82 |
fmtoverride = dict.fromkeys(["node_list", "pinst_list"], (",".join, False)) |
|
96 |
fmtoverride = { |
|
97 |
"node_list": (",".join, False), |
|
98 |
"pinst_list": (",".join, False), |
|
99 |
"ndparams": (_FmtDict, False), |
|
100 |
} |
|
83 | 101 |
|
84 | 102 |
return GenericList(constants.QR_GROUP, desired_fields, args, None, |
85 | 103 |
opts.separator, not opts.no_headers, |
Also available in: Unified diff