Revision f6eb380d
b/lib/cli.py | ||
---|---|---|
168 | 168 |
"TAG_ADD_OPT", |
169 | 169 |
"TAG_SRC_OPT", |
170 | 170 |
"TIMEOUT_OPT", |
171 |
"TO_GROUP_OPT", |
|
171 | 172 |
"UIDPOOL_OPT", |
172 | 173 |
"USEUNITS_OPT", |
173 | 174 |
"USE_REPL_NET_OPT", |
... | ... | |
1228 | 1229 |
action="store_true", default=False, |
1229 | 1230 |
help="Pause instance at startup") |
1230 | 1231 |
|
1232 |
TO_GROUP_OPT = cli_option("--to", dest="to", metavar="<group>", |
|
1233 |
help="Destination node group (name or uuid)", |
|
1234 |
default=None, action="append", |
|
1235 |
completion_suggest=OPT_COMPL_ONE_NODEGROUP) |
|
1236 |
|
|
1231 | 1237 |
|
1232 | 1238 |
#: Options provided by all commands |
1233 | 1239 |
COMMON_OPTS = [DEBUG_OPT] |
b/lib/client/gnt_group.py | ||
---|---|---|
181 | 181 |
SubmitOpCode(op, opts=opts) |
182 | 182 |
|
183 | 183 |
|
184 |
def EvacuateGroup(opts, args): |
|
185 |
"""Evacuate a node group. |
|
186 |
|
|
187 |
""" |
|
188 |
(group_name, ) = args |
|
189 |
|
|
190 |
cl = GetClient() |
|
191 |
|
|
192 |
op = opcodes.OpGroupEvacuate(group_name=group_name, |
|
193 |
iallocator=opts.iallocator, |
|
194 |
target_groups=opts.to, |
|
195 |
early_release=opts.early_release) |
|
196 |
result = SubmitOpCode(op, cl=cl, opts=opts) |
|
197 |
|
|
198 |
# Keep track of submitted jobs |
|
199 |
jex = JobExecutor(cl=cl, opts=opts) |
|
200 |
|
|
201 |
for (status, job_id) in result[constants.JOB_IDS_KEY]: |
|
202 |
jex.AddJobId(None, status, job_id) |
|
203 |
|
|
204 |
results = jex.GetResults() |
|
205 |
bad_cnt = len([row for row in results if not row[0]]) |
|
206 |
if bad_cnt == 0: |
|
207 |
ToStdout("All instances evacuated successfully.") |
|
208 |
rcode = constants.EXIT_SUCCESS |
|
209 |
else: |
|
210 |
ToStdout("There were %s errors during the evacuation.", bad_cnt) |
|
211 |
rcode = constants.EXIT_FAILURE |
|
212 |
|
|
213 |
return rcode |
|
214 |
|
|
184 | 215 |
commands = { |
185 | 216 |
"add": ( |
186 | 217 |
AddGroup, ARGS_ONE_GROUP, [DRY_RUN_OPT, ALLOC_POLICY_OPT, NODE_PARAMS_OPT], |
... | ... | |
209 | 240 |
"rename": ( |
210 | 241 |
RenameGroup, [ArgGroup(min=2, max=2)], [DRY_RUN_OPT], |
211 | 242 |
"[--dry-run] <group-name> <new-name>", "Rename a node group"), |
243 |
"evacuate": ( |
|
244 |
EvacuateGroup, [ArgGroup(min=1, max=1)], |
|
245 |
[TO_GROUP_OPT, IALLOCATOR_OPT, EARLY_RELEASE_OPT], |
|
246 |
"-I <iallocator> [--to <group>]", "Evacuate all instances within a group"), |
|
212 | 247 |
"list-tags": ( |
213 | 248 |
ListTags, ARGS_ONE_GROUP, [PRIORITY_OPT], |
214 | 249 |
"<instance_name>", "List the tags of the given instance"), |
b/man/gnt-group.rst | ||
---|---|---|
138 | 138 |
Renames a given group from *oldname* to *newname*. |
139 | 139 |
|
140 | 140 |
|
141 |
EVACUATE |
|
142 |
~~~~~~~~ |
|
143 |
|
|
144 |
**evacuate** [--iallocator *NAME*] [--to *GROUP*...] {*group*} |
|
145 |
|
|
146 |
This command will move all instances out of the given node group. |
|
147 |
Instances are placed in a new group by an iallocator, either given on |
|
148 |
the command line or as a cluster default. |
|
149 |
|
|
150 |
If no specific destination groups are specified using ``--to``, all |
|
151 |
groups except the evacuated group are considered. |
|
152 |
|
|
153 |
Example:: |
|
154 |
|
|
155 |
# gnt-group evacuate -I hail --to rack4 rack1 |
|
156 |
|
|
157 |
|
|
141 | 158 |
TAGS |
142 | 159 |
~~~~ |
143 | 160 |
|
Also available in: Unified diff