1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-10 16:58:47 +03:00

commands: lvremove: also process historical LVs

This commit is contained in:
Peter Rajnoha 2016-03-01 15:27:08 +01:00
parent f833a6d074
commit 53b064b9ae
3 changed files with 16 additions and 7 deletions

View File

@ -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;
}

View File

@ -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",

View File

@ -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);