1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

lvconvert: cleanup prompting

This commit is contained in:
Heinz Mauelshagen 2017-04-06 19:59:57 +02:00
parent eb6302c8cb
commit ef3e1013aa

View File

@ -1989,8 +1989,8 @@ static int _raid_reshape_keep_images(struct logical_volume *lv,
if (seg->segtype != new_segtype)
log_print_unless_silent("Converting %s LV %s to %s.",
lvseg_name(seg), display_lvname(lv), new_segtype->name);
if (!yes && yes_no_prompt("Are you sure you want to convert %s LV %s? [y/n]: ",
lvseg_name(seg), display_lvname(lv)) == 'n') {
if (!yes && yes_no_prompt("Are you sure you want to convert %s LV %s to %s? [y/n]: ",
lvseg_name(seg), display_lvname(lv), new_segtype->name) == 'n') {
log_error("Logical volume %s NOT converted.", display_lvname(lv));
return 0;
}
@ -4577,7 +4577,7 @@ static int _raid1_to_mirrored_wrapper(TAKEOVER_FN_ARGS)
if (!_raid_in_sync(lv))
return_0;
if (!yes && yes_no_prompt("Are you sure you want to convert %s back to the older \"%s\" type? [y/n]: ",
if (!yes && yes_no_prompt("Are you sure you want to convert %s back to the older %s type? [y/n]: ",
display_lvname(lv), SEG_TYPE_NAME_MIRROR) == 'n') {
log_error("Logical volume %s NOT converted to \"%s\".",
display_lvname(lv), SEG_TYPE_NAME_MIRROR);
@ -4888,13 +4888,6 @@ static int _takeover_downconvert_wrapper(TAKEOVER_FN_ARGS)
} else
*res_str = '\0';
if (!yes && yes_no_prompt("Are you sure you want to convert \"%s\" LV %s to \"%s\" type%s? [y/n]: ",
lvseg_name(seg), display_lvname(lv), new_segtype->name, res_str) == 'n') {
log_error("Logical volume %s NOT converted to \"%s\"",
display_lvname(lv), new_segtype->name);
return 0;
}
/* Archive metadata */
if (!archive(lv->vg))
return_0;
@ -5737,13 +5730,6 @@ replaced:
if (segtype_sav != *segtype)
log_warn("Replaced LV type %s with possible type %s.",
segtype_sav->name, (*segtype)->name);
if (!yes && yes_no_prompt("Do you want to convert %s LV %s to %s? [y/n]: ",
lvseg_name(seg_from), display_lvname(seg_from->lv),
(*segtype)->name) == 'n') {
log_error("Logical volume %s NOT converted.", display_lvname(seg_from->lv));
return 0;
}
return 1;
}
@ -5855,6 +5841,15 @@ static int _conversion_options_allowed(const struct lv_segment *seg_from,
r = 0;
}
if (r &&
strcmp((*segtype_to)->name, SEG_TYPE_NAME_MIRROR) && /* "mirror" is prompted for later */
!yes && yes_no_prompt("Are you sure you want to convert %s LV %s to %s type? [y/n]: ",
lvseg_name(seg_from), display_lvname(seg_from->lv),
(*segtype_to)->name) == 'n') {
log_error("Logical volume %s NOT converted.", display_lvname(seg_from->lv));
r = 0;
}
return r;
}