diff --git a/tools/lvconvert.c b/tools/lvconvert.c index d0aa7337f..ce858ae1d 100644 --- a/tools/lvconvert.c +++ b/tools/lvconvert.c @@ -1823,6 +1823,7 @@ static void _lvconvert_raid_repair_ask(struct cmd_context *cmd, static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *lp) { + const char *new_type; int replace = 0, image_count = 0; struct dm_list *failed_pvs; struct cmd_context *cmd = lv->vg->cmd; @@ -1832,6 +1833,16 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l if (!lp->segtype) lp->segtype = seg->segtype; + if ((new_type = arg_str_value(cmd, type_ARG, NULL)) && + !strcmp(new_type, SEG_TYPE_NAME_LINEAR)) { + if (arg_is_set(cmd, mirrors_ARG) && (arg_uint_value(cmd, mirrors_ARG, 0) != 0)) { + log_error("Cannot specify mirrors with linear type."); + return 0; + } + lp->mirrors_supplied = 1; + lp->mirrors = 0; + } + /* Can only change image count for raid1 and linear */ if (lp->mirrors_supplied && !seg_is_mirrored(seg) && !seg_is_linear(seg)) { log_error("'--mirrors/-m' is not compatible with %s",