Revision a82a94e1
b/lib/cli.py | ||
---|---|---|
97 | 97 |
"GLOBAL_SHARED_FILEDIR_OPT", |
98 | 98 |
"HOTPLUG_OPT", |
99 | 99 |
"HOTPLUG_IF_POSSIBLE_OPT", |
100 |
"KEEPDISKS_OPT", |
|
100 | 101 |
"HVLIST_OPT", |
101 | 102 |
"HVOPTS_OPT", |
102 | 103 |
"HYPERVISOR_OPT", |
... | ... | |
1650 | 1651 |
help="Hotplug devices in case" |
1651 | 1652 |
" hotplug is supported") |
1652 | 1653 |
|
1654 |
KEEPDISKS_OPT = cli_option("--keep-disks", dest="keep_disks", |
|
1655 |
action="store_true", default=False, |
|
1656 |
help="Do not remove disks") |
|
1657 |
|
|
1653 | 1658 |
#: Options provided by all commands |
1654 | 1659 |
COMMON_OPTS = [DEBUG_OPT, REASON_OPT] |
1655 | 1660 |
|
b/lib/client/gnt_instance.py | ||
---|---|---|
459 | 459 |
|
460 | 460 |
op = opcodes.OpInstanceRemove(instance_name=instance_name, |
461 | 461 |
ignore_failures=opts.ignore_failures, |
462 |
shutdown_timeout=opts.shutdown_timeout) |
|
462 |
shutdown_timeout=opts.shutdown_timeout, |
|
463 |
keep_disks=opts.keep_disks) |
|
463 | 464 |
SubmitOrSend(op, opts, cl=cl) |
464 | 465 |
return 0 |
465 | 466 |
|
... | ... | |
1372 | 1373 |
disks=disks, |
1373 | 1374 |
hotplug=opts.hotplug, |
1374 | 1375 |
hotplug_if_possible=opts.hotplug_if_possible, |
1376 |
keep_disks=opts.keep_disks, |
|
1375 | 1377 |
disk_template=opts.disk_template, |
1376 | 1378 |
remote_node=opts.node, |
1377 | 1379 |
pnode=opts.new_primary_node, |
... | ... | |
1559 | 1561 |
"remove": ( |
1560 | 1562 |
RemoveInstance, ARGS_ONE_INSTANCE, |
1561 | 1563 |
[FORCE_OPT, SHUTDOWN_TIMEOUT_OPT, IGNORE_FAILURES_OPT, SUBMIT_OPT, |
1562 |
DRY_RUN_OPT, PRIORITY_OPT], |
|
1564 |
DRY_RUN_OPT, PRIORITY_OPT, KEEPDISKS_OPT],
|
|
1563 | 1565 |
"[-f] <instance>", "Shuts down the instance and removes it"), |
1564 | 1566 |
"rename": ( |
1565 | 1567 |
RenameInstance, |
... | ... | |
1580 | 1582 |
OSPARAMS_OPT, DRY_RUN_OPT, PRIORITY_OPT, NWSYNC_OPT, OFFLINE_INST_OPT, |
1581 | 1583 |
ONLINE_INST_OPT, IGNORE_IPOLICY_OPT, RUNTIME_MEM_OPT, |
1582 | 1584 |
NOCONFLICTSCHECK_OPT, NEW_PRIMARY_OPT, HOTPLUG_OPT, |
1583 |
HOTPLUG_IF_POSSIBLE_OPT], |
|
1585 |
HOTPLUG_IF_POSSIBLE_OPT, KEEPDISKS_OPT],
|
|
1584 | 1586 |
"<instance>", "Alters the parameters of an instance"), |
1585 | 1587 |
"shutdown": ( |
1586 | 1588 |
GenericManyOps("shutdown", _ShutdownInstance), [ArgInstance()], |
b/lib/cmdlib/instance.py | ||
---|---|---|
3280 | 3280 |
|
3281 | 3281 |
(anno_disk,) = AnnotateDiskParams(self.instance, [root], self.cfg) |
3282 | 3282 |
for node, disk in anno_disk.ComputeNodeTree(self.instance.primary_node): |
3283 |
if self.op.keep_disks and disk.dev_type in constants.DT_EXT: |
|
3284 |
continue |
|
3283 | 3285 |
self.cfg.SetDiskID(disk, node) |
3284 | 3286 |
msg = self.rpc.call_blockdev_remove(node, disk).fail_msg |
3285 | 3287 |
if msg: |
b/lib/cmdlib/instance_utils.py | ||
---|---|---|
271 | 271 |
else: |
272 | 272 |
edata = device.ComputeNodeTree(instance.primary_node) |
273 | 273 |
for node, disk in edata: |
274 |
if lu.op.keep_disks and disk.dev_type in constants.DT_EXT: |
|
275 |
continue |
|
274 | 276 |
lu.cfg.SetDiskID(disk, node) |
275 | 277 |
result = lu.rpc.call_blockdev_remove(node, disk) |
276 | 278 |
if result.fail_msg: |
b/lib/opcodes.py | ||
---|---|---|
1449 | 1449 |
_PShutdownTimeout, |
1450 | 1450 |
("ignore_failures", False, ht.TBool, |
1451 | 1451 |
"Whether to ignore failures during removal"), |
1452 |
("keep_disks", False, ht.TBool, "Whether to remove disks") |
|
1452 | 1453 |
] |
1453 | 1454 |
OP_RESULT = ht.TNone |
1454 | 1455 |
|
... | ... | |
1738 | 1739 |
("conflicts_check", True, ht.TBool, "Check for conflicting IPs"), |
1739 | 1740 |
("hotplug", False, ht.TBool, "Whether to hotplug device"), |
1740 | 1741 |
("hotplug_if_possible", False, ht.TBool, "If possible then hotplug device"), |
1742 |
("keep_disks", False, ht.TBool, "Whether to remove disks") |
|
1741 | 1743 |
] |
1742 | 1744 |
OP_RESULT = _TSetParamsResult |
1743 | 1745 |
|
b/src/Ganeti/OpCodes.hs | ||
---|---|---|
324 | 324 |
[ pInstanceName |
325 | 325 |
, pShutdownTimeout |
326 | 326 |
, pIgnoreFailures |
327 |
, pKeepDisks |
|
327 | 328 |
]) |
328 | 329 |
, ("OpInstanceRename", |
329 | 330 |
[ pInstanceName |
... | ... | |
403 | 404 |
, pIpConflictsCheck |
404 | 405 |
, pHotplug |
405 | 406 |
, pHotplugIfPossible |
407 |
, pKeepDisks |
|
406 | 408 |
]) |
407 | 409 |
, ("OpInstanceGrowDisk", |
408 | 410 |
[ pInstanceName |
b/src/Ganeti/OpParams.hs | ||
---|---|---|
98 | 98 |
, pIgnoreIpolicy |
99 | 99 |
, pHotplug |
100 | 100 |
, pHotplugIfPossible |
101 |
, pKeepDisks |
|
101 | 102 |
, pAllowRuntimeChgs |
102 | 103 |
, pInstDisks |
103 | 104 |
, pInstSnaps |
... | ... | |
742 | 743 |
pHotplugIfPossible :: Field |
743 | 744 |
pHotplugIfPossible = defaultFalse "hotplug_if_possible" |
744 | 745 |
|
746 |
-- | Whether to remove disks. |
|
747 |
pKeepDisks :: Field |
|
748 |
pKeepDisks = defaultFalse "keep_disks" |
|
749 |
|
|
745 | 750 |
-- * Parameters for node resource model |
746 | 751 |
|
747 | 752 |
-- | Set hypervisor states. |
Also available in: Unified diff