diff options
author | Heinz Mauelshagen <heinzm@redhat.com> | 2017-04-06 19:59:57 +0200 |
---|---|---|
committer | Heinz Mauelshagen <heinzm@redhat.com> | 2017-04-06 19:59:57 +0200 |
commit | ef3e1013aa8d7797fa432e2da219255178b8ede3 (patch) | |
tree | 82206a248b62dcf8fee5c268b63a25588882bb32 | |
parent | eb6302c8cb6bfd1d9831e5ff3d76ecbb49613178 (diff) | |
download | lvm2-ef3e1013aa8d7797fa432e2da219255178b8ede3.tar.gz |
lvconvert: cleanup prompting
-rw-r--r-- | lib/metadata/raid_manip.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c index 922eea72b..93c3c3024 100644 --- a/lib/metadata/raid_manip.c +++ b/lib/metadata/raid_manip.c @@ -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; } |