diff options
author | Peter Rajnoha <prajnoha@redhat.com> | 2016-03-01 15:27:08 +0100 |
---|---|---|
committer | Peter Rajnoha <prajnoha@redhat.com> | 2016-03-03 13:50:59 +0100 |
commit | 53b064b9aed3bd2237638cab778b3bffd018ce08 (patch) | |
tree | c36552c71d1a9d9bd66646ad6379c024655c5931 | |
parent | f833a6d074979813e8bd9980b719b09758bd833a (diff) | |
download | lvm2-53b064b9aed3bd2237638cab778b3bffd018ce08.tar.gz |
commands: lvremove: also process historical LVs
-rw-r--r-- | lib/metadata/lv_manip.c | 19 | ||||
-rw-r--r-- | tools/commands.h | 3 | ||||
-rw-r--r-- | tools/lvremove.c | 1 |
3 files changed, 16 insertions, 7 deletions
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index c61287361..85f61a1c7 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -5691,7 +5691,7 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv, struct volume_group *vg; struct logical_volume *format1_origin = NULL; int format1_reload_required = 0; - int visible; + int visible, historical; struct logical_volume *pool_lv = NULL; struct logical_volume *lock_lv = lv; struct lv_segment *cache_seg = NULL; @@ -5782,7 +5782,7 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv, } } - if ((force == PROMPT) && ask_discard && + if (!lv_is_historical(lv) && (force == PROMPT) && ask_discard && yes_no_prompt("Do you really want to remove and DISCARD " "logical volume %s? [y/n]: ", lv->name) == 'n') { @@ -5868,10 +5868,15 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv, } visible = lv_is_visible(lv); + historical = lv_is_historical(lv); - log_verbose("Releasing logical volume \"%s\"", lv->name); + log_verbose("Releasing %slogical volume \"%s\"", + historical ? "historical " : "", + historical ? lv->this_glv->historical->name : lv->name); if (!lv_remove(lv)) { - log_error("Error releasing logical volume \"%s\"", lv->name); + log_error("Error releasing %slogical volume \"%s\"", + historical ? "historical ": "", + historical ? lv->this_glv->historical->name : lv->name); return 0; } @@ -5934,8 +5939,10 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv, lockd_lv(cmd, lock_lv, "un", LDLV_PERSISTENT); lockd_free_lv(cmd, vg, lv->name, &lv->lvid.id[1], lv->lock_args); - if (!suppress_remove_message && visible) - log_print_unless_silent("Logical volume \"%s\" successfully removed", lv->name); + if (!suppress_remove_message && (visible || historical)) + log_print_unless_silent("%sogical volume \"%s\" successfully removed", + historical ? "Historical l" : "L", + historical ? lv->this_glv->historical->name : lv->name); return 1; } diff --git a/tools/commands.h b/tools/commands.h index 97f7de1ec..bc5eb9218 100644 --- a/tools/commands.h +++ b/tools/commands.h @@ -606,7 +606,8 @@ xx(lvremove, "\t[--version]\n" "\tLogicalVolume[Path] [LogicalVolume[Path]...]\n", - autobackup_ARG, force_ARG, nohistory_ARG, noudevsync_ARG, select_ARG, test_ARG) + autobackup_ARG, force_ARG, nohistory_ARG, noudevsync_ARG, + select_ARG, test_ARG) xx(lvrename, "Rename a logical volume", diff --git a/tools/lvremove.c b/tools/lvremove.c index 220d3e3a9..18da1fa73 100644 --- a/tools/lvremove.c +++ b/tools/lvremove.c @@ -24,6 +24,7 @@ int lvremove(struct cmd_context *cmd, int argc, char **argv) } cmd->handles_missing_pvs = 1; + cmd->include_historical_lvs = 1; return process_each_lv(cmd, argc, argv, READ_FOR_UPDATE, NULL, &lvremove_single); |