1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

thin: fix chunk_size conversion prompt skip

Use --force only enables prompting for dangerous operation.
User has to add --yes to skip this prompt.
This commit is contained in:
Zdenek Kabelac 2014-07-01 11:04:14 +02:00
parent 93a80018ae
commit 3af761ba16
2 changed files with 20 additions and 8 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.108 -
=================================
Require --yes option to skip prompt to lvconvert thin pool chunksize.
Support lvremove -ff to remove thin volumes from broken thin pools.
Require --yes to skip raid repair prompt.
Change makefile %.d generation to handle filename changes without make clean.

View File

@ -2805,15 +2805,26 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
if (!arg_count(cmd, chunksize_ARG))
lp->chunk_size = seg->chunk_size;
else if ((lp->chunk_size != seg->chunk_size) &&
!lp->force &&
yes_no_prompt("Do you really want to change chunk size %s to %s for %s/%s "
"pool volume? [y/n]: ", display_size(cmd, seg->chunk_size),
else if (lp->chunk_size != seg->chunk_size) {
if (lp->force == PROMPT) {
log_error("Chunk size can be only changed with --force. Conversion aborted.");
return 0;
}
/* Ok, user has likely some serious reason for this */
if (!lp->yes &&
yes_no_prompt("Do you really want to change chunk size %s to %s "
"for %s/%s pool volume? [y/n]: ",
display_size(cmd, seg->chunk_size),
display_size(cmd, lp->chunk_size),
pool_lv->vg->name, pool_lv->name) == 'n') {
log_error("Conversion aborted.");
return 0;
}
log_warn("WARNING: Changing chunk size %s to %s for %s/%s pool volume.",
display_size(cmd, seg->chunk_size),
display_size(cmd, lp->chunk_size),
pool_lv->vg->name, pool_lv->name);
}
if (!arg_count(cmd, discards_ARG))
lp->discards = seg->discards;
if (!arg_count(cmd, zero_ARG))