diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2017-02-22 15:12:54 +0100 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2017-02-22 15:35:04 +0100 |
commit | 9712995edd60220cd525c51b6bab9f7bd3b38b5a (patch) | |
tree | 616f6d31d13c6f1fd9a53f1eb800adc02a77b579 | |
parent | 6716f5a2f46f034f24d01918cc1dc78cd7bac9be (diff) | |
download | lvm2-9712995edd60220cd525c51b6bab9f7bd3b38b5a.tar.gz |
snapshot: improve removal of active origin volume
Previously when lvremove tried to remove 'active' origin,
it had been asking for every 'snapshot' LV separately
and doing individual single snapshot removals first.
To be faster it now deactivates origin before removal
all connected snapshots.
This avoids multiple reloads of dm table for origin volume
which were unnecessary as origin was meant to be removed as well.
-rw-r--r-- | WHATS_NEW | 1 | ||||
-rw-r--r-- | lib/metadata/lv_manip.c | 17 |
2 files changed, 14 insertions, 4 deletions
@@ -1,5 +1,6 @@ Version 2.02.169 - ===================================== + Deactivate active origin first before removal for improved workflow. Fix regression of accepting options --type and -m with lvresize (2.02.158). Add lvconvert --swapmetadata, new specific way to swap pool metadata LVs. Add lvconvert --startpoll, new specific way to start polling conversions. diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index d8f869d7b..78cc30e96 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -6229,12 +6229,21 @@ int lv_remove_with_dependencies(struct cmd_context *cmd, struct logical_volume * /* 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') + (yes_no_prompt("Do you really want to remove%s " + "%sorigin logical volume %s with %u snapshot(s)? [y/n]: ", + lv_is_active(lv) ? " active" : "", + vg_is_clustered(lv->vg) ? "clustered " : "", + display_lvname(lv), + lv->origin_count) == 'n')) goto no_remove; + if (!deactivate_lv(cmd, lv)) { + stack; + goto no_remove; + } + log_verbose("Removing origin logical volume %s with %u snapshots(s).", + display_lvname(lv), lv->origin_count); + 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, |