1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Query before removing inactive snapshots

Removal of an inactive origin removes also all related snapshots.

When we now support 'old' external snapshots with thin volumes,
removal of pool will not only drop all thin volumes, but as
a consequence also all snapshots - which might be seen a bit
unexpected for the user - so add a query to confirm such action.

lvremove -f will skip the prompt.
This commit is contained in:
Zdenek Kabelac 2011-11-18 19:25:20 +00:00
parent e8a40f6571
commit 37f274ced9
3 changed files with 13 additions and 2 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.89 -
==================================
Add query before removing snapshots when inactive snapshot origin is removed.
Allow changing availability state of snapshots.
Skip non-virtual snapshots for availability change for lvchange with vg name.
Adjusted mirror region size only for mirrors and raids.

View File

@ -3248,7 +3248,17 @@ int lv_remove_with_dependencies(struct cmd_context *cmd, struct logical_volume *
}
if (lv_is_origin(lv)) {
/* remove snapshot LVs first */
/* Remove snapshot LVs first */
if ((force == PROMPT) &&
/* Active snapshot already needs to confirm each active LV */
!lv_is_active(lv) &&
yes_no_prompt("Removing origin %s will also remove %u "
"snapshots(s). Proceed? [y/n]: ",
lv->name, lv->origin_count) == 'n') {
log_error("Logical volume %s not removed.", lv->name);
return 0;
}
dm_list_iterate_safe(snh, snht, &lv->snapshot_segs)
if (!lv_remove_with_dependencies(cmd, dm_list_struct_base(snh, struct lv_segment,
origin_list)->cow,

View File

@ -122,7 +122,7 @@ lvcreate -s --virtualoriginsize 64m -L 32m -n $lv1 $vg
lvrename $vg/$lv1 $vg/$lv2
lvcreate -s --virtualoriginsize 64m -L 32m -n $lv1 $vg
lvchange -a n $vg/$lv1
lvremove $vg/$lv1
lvremove -ff $vg/$lv1
lvremove -ff $vg
# readahead default (auto), none, #, auto