Revision 4da7909a lib/client/gnt_group.py
b/lib/client/gnt_group.py | ||
---|---|---|
105 | 105 |
return 0 |
106 | 106 |
|
107 | 107 |
|
108 |
def SetGroupParams(opts, args): |
|
109 |
"""Modifies a node group's parameters. |
|
110 |
|
|
111 |
@param opts: the command line options seletect by the user |
|
112 |
@type args: list |
|
113 |
@param args: should contain only one element, the node group name |
|
114 |
|
|
115 |
@rtype: int |
|
116 |
@return: the desired exit code |
|
117 |
|
|
118 |
""" |
|
119 |
all_changes = { |
|
120 |
"ndparams": opts.ndparams, |
|
121 |
} |
|
122 |
|
|
123 |
if all_changes.values().count(None) == len(all_changes): |
|
124 |
ToStderr("Please give at least one of the parameters.") |
|
125 |
return 1 |
|
126 |
|
|
127 |
op = opcodes.OpSetGroupParams(group_name=args[0], **all_changes) |
|
128 |
result = SubmitOrSend(op, opts) |
|
129 |
|
|
130 |
if result: |
|
131 |
ToStdout("Modified node group %s", args[0]) |
|
132 |
for param, data in result: |
|
133 |
ToStdout(" - %-5s -> %s", param, data) |
|
134 |
|
|
135 |
return 0 |
|
136 |
|
|
137 |
|
|
108 | 138 |
def RemoveGroup(opts, args): |
109 | 139 |
"""Remove a node group from the cluster. |
110 | 140 |
|
... | ... | |
146 | 176 |
"Lists the node groups in the cluster. The available fields are (see" |
147 | 177 |
" the man page for details): %s. The default list is (in order): %s." % |
148 | 178 |
(utils.CommaJoin(_LIST_HEADERS), utils.CommaJoin(_LIST_DEF_FIELDS))), |
179 |
"modify": ( |
|
180 |
SetGroupParams, ARGS_ONE_GROUP, |
|
181 |
[DRY_RUN_OPT, SUBMIT_OPT, NODE_PARAMS_OPT], |
|
182 |
"<group_name>", "Alters the parameters of a node group"), |
|
149 | 183 |
"remove": ( |
150 | 184 |
RemoveGroup, ARGS_ONE_GROUP, [DRY_RUN_OPT], |
151 | 185 |
"[--dry-run] <group_name>", |
Also available in: Unified diff