master - thin: fix chunk_size conversion prompt skip
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3af761ba167236a2d66f8687ade5db6311498d06 Commit: 3af761ba167236a2d66f8687ade5db6311498d06 Parent: 93a80018ae8e2f3f56e56b42237779661c9040b3 Author: Zdenek Kabelac <[email protected]> AuthorDate: Tue Jul 1 11:04:14 2014 +0200 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Wed Jul 2 10:43:56 2014 +0200
thin: fix chunk_size conversion prompt skip
Use --force only enables prompting for dangerous operation. User has to add --yes to skip this prompt.
--- WHATS_NEW | 1 + tools/lvconvert.c | 27 +++++++++++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-)
WHATS_NEW +1 -0
@@ -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.
tools/lvconvert.c +19 -8
@@ -2805,14 +2805,25 @@ 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), -display_size (cmd, lp->chunk_size), - pool_lv->vg->name, pool_lv->name) =='n' ) { -log_error ("Conversion aborted." ); -return 0 ; +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;