Revision 6605411d
b/lib/cmdlib.py | ||
---|---|---|
4254 | 4254 |
""" |
4255 | 4255 |
HPATH = "disk-grow" |
4256 | 4256 |
HTYPE = constants.HTYPE_INSTANCE |
4257 |
_OP_REQP = ["instance_name", "disk", "amount"] |
|
4257 |
_OP_REQP = ["instance_name", "disk", "amount", "wait_for_sync"]
|
|
4258 | 4258 |
REQ_BGL = False |
4259 | 4259 |
|
4260 | 4260 |
def ExpandNames(self): |
... | ... | |
4337 | 4337 |
(node, result[1])) |
4338 | 4338 |
disk.RecordGrow(self.op.amount) |
4339 | 4339 |
self.cfg.Update(instance) |
4340 |
return |
|
4340 |
if self.op.wait_for_sync: |
|
4341 |
disk_abort = not _WaitForSync(self.cfg, instance, self.proc) |
|
4342 |
if disk_abort: |
|
4343 |
logger.Error("Warning: disk sync-ing has not returned a good status.\n" |
|
4344 |
" Please check the instance.") |
|
4341 | 4345 |
|
4342 | 4346 |
|
4343 | 4347 |
class LUQueryInstanceData(NoHooksLU): |
b/lib/opcodes.py | ||
---|---|---|
432 | 432 |
"""Grow a disk of an instance.""" |
433 | 433 |
OP_ID = "OP_INSTANCE_GROW_DISK" |
434 | 434 |
OP_DSC_FIELD = "instance_name" |
435 |
__slots__ = ["instance_name", "disk", "amount"] |
|
435 |
__slots__ = ["instance_name", "disk", "amount", "wait_for_sync"]
|
|
436 | 436 |
|
437 | 437 |
|
438 | 438 |
# OS opcodes |
b/man/gnt-instance.sgml | ||
---|---|---|
1176 | 1176 |
<title>GROW-DISK</title> |
1177 | 1177 |
<cmdsynopsis> |
1178 | 1178 |
<command>grow-disk</command> |
1179 |
<arg>--no-wait-for-sync</arg> |
|
1179 | 1180 |
<arg choice="req"><replaceable>instance</replaceable></arg> |
1180 | 1181 |
<arg choice="req"><replaceable>disk</replaceable></arg> |
1181 | 1182 |
<arg choice="req"><replaceable>amount</replaceable></arg> |
... | ... | |
1232 | 1233 |
create problems (except for unused space). |
1233 | 1234 |
</para> |
1234 | 1235 |
|
1235 |
<para>Example (increasing sda for instance1 with 16GiB): |
|
1236 |
<para> |
|
1237 |
If you do not want gnt-instance to wait for the new disk |
|
1238 |
region to be synced, use the |
|
1239 |
<option>--no-wait-for-sync</option> option. |
|
1240 |
</para> |
|
1241 |
|
|
1242 |
|
|
1243 |
<para>Example (increase sda for instance1 by 16GiB): |
|
1236 | 1244 |
<screen> |
1237 | 1245 |
# gnt-instance grow-disk instance1.example.com sda 16g |
1238 | 1246 |
</screen> |
b/scripts/gnt-instance | ||
---|---|---|
443 | 443 |
instance = args[0] |
444 | 444 |
disk = args[1] |
445 | 445 |
amount = utils.ParseUnit(args[2]) |
446 |
op = opcodes.OpGrowDisk(instance_name=instance, disk=disk, amount=amount) |
|
446 |
op = opcodes.OpGrowDisk(instance_name=instance, disk=disk, amount=amount, |
|
447 |
wait_for_sync=opts.wait_for_sync) |
|
447 | 448 |
SubmitOrSend(op, opts) |
448 | 449 |
return 0 |
449 | 450 |
|
... | ... | |
1069 | 1070 |
'deactivate-disks': (DeactivateDisks, ARGS_ONE, [DEBUG_OPT, SUBMIT_OPT], |
1070 | 1071 |
"<instance>", |
1071 | 1072 |
"Deactivate an instance's disks"), |
1072 |
'grow-disk': (GrowDisk, ARGS_FIXED(3), [DEBUG_OPT, SUBMIT_OPT], |
|
1073 |
'grow-disk': (GrowDisk, ARGS_FIXED(3), |
|
1074 |
[DEBUG_OPT, SUBMIT_OPT, |
|
1075 |
make_option("--no-wait-for-sync", |
|
1076 |
dest="wait_for_sync", default=True, |
|
1077 |
action="store_false", |
|
1078 |
help="Don't wait for sync (DANGEROUS!)"), |
|
1079 |
], |
|
1073 | 1080 |
"<instance> <disk> <size>", "Grow an instance's disk"), |
1074 | 1081 |
'list-tags': (ListTags, ARGS_ONE, [DEBUG_OPT], |
1075 | 1082 |
"<instance_name>", "List the tags of the given instance"), |
b/tools/burnin | ||
---|---|---|
288 | 288 |
growth = getattr(self.opts, '%s_growth' % disk) |
289 | 289 |
if growth > 0: |
290 | 290 |
op = opcodes.OpGrowDisk(instance_name=instance, disk=disk, |
291 |
amount=growth) |
|
291 |
amount=growth, wait_for_sync=True)
|
|
292 | 292 |
Log("- Increase %s's %s disk by %s MB" % (instance, disk, growth)) |
293 | 293 |
self.ExecOp(op) |
294 | 294 |
|
Also available in: Unified diff