mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
lvconvert: allow converting type raid1 to type linear
The code could perform this conversion but ironically did not recognize the standard command form, only the the unpreferred "implication-based" command form. "lvconvert --type linear VG/RaidLV" would fail, but "lvconvert --mirrors 0 VG/RaidLV" would succeed.
This commit is contained in:
parent
37d1b7b745
commit
13cd3ff5a0
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user