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

RAID/MIRROR: Honor mirror_segtype_default when upconverting linear LVs

If the user would upconvert a linear LV to a mirror without specifying
the segment type ("--type mirror" vs "--type raid1"), the "mirror"
segment type would be chosen without consulting the 'default_mirror_segtype'
setting in lvm.conf.  This is now used as the basis for determining
which should be used if left unspecified.
This commit is contained in:
Jonathan Brassow 2013-06-19 17:50:10 -05:00
parent 4d2aa6a7aa
commit a6d13308ec
4 changed files with 31 additions and 3 deletions

View File

@ -1,5 +1,7 @@
Version 2.02.99 -
===================================
Use mirror_segtype_default if type not specified for linear->mirror upconvert.
Make upconvert from linear use mirror_segtype_default to determine segtype.
Fix use of too big chunks of memory when communication with lvmetad.
Fix vgcfgrestore crash when specified incorrect vg name.
Refine lvm.conf and man page documentation for autoactivation feature.

View File

@ -16,9 +16,17 @@ aux prepare_pvs 5 10
DEVRANGE="0-32"
vgcreate -s 32k $vg $(cat DEVICES)
# convert from linear to 2-way mirror
# convert from linear to 2-way mirror ("mirror" default type)
lvcreate -aey -l2 -n $lv1 $vg "$dev1"
lvconvert -i1 -m+1 $vg/$lv1 "$dev2" "$dev3:0-1"
lvconvert -i1 -m+1 $vg/$lv1 "$dev2" "$dev3:0-1" \
--config 'global { mirror_segtype_default = "mirror" }'
check mirror $vg $lv1 "$dev3"
lvremove -ff $vg
# convert from linear to 2-way mirror (override "raid1" default type)
lvcreate -aey -l2 -n $lv1 $vg "$dev1"
lvconvert --type mirror -i1 -m+1 $vg/$lv1 "$dev2" "$dev3:0-1" \
--config 'global { mirror_segtype_default = "raid1" }'
check mirror $vg $lv1 "$dev3"
lvremove -ff $vg

View File

@ -135,6 +135,24 @@ lvconvert --merge $vg/${lv1}_rimage_2
# FIXME: ensure no residual devices
lvremove -ff $vg
###########################################
# Linear to RAID1 conversion ("raid1" default segtype)
###########################################
lvcreate -l 2 -n $lv1 $vg
lvconvert -m 1 $vg/$lv1 \
--config 'global { mirror_segtype_default = "raid1" }'
lvs --noheadings -o attr $vg/$lv1 | grep '^r*'
lvremove -ff $vg
###########################################
# Linear to RAID1 conversion (override "mirror" default segtype)
###########################################
lvcreate -l 2 -n $lv1 $vg
lvconvert --type raid1 -m 1 $vg/$lv1 \
--config 'global { mirror_segtype_default = "mirror" }'
lvs --noheadings -o attr $vg/$lv1 | grep '^r*'
lvremove -ff $vg
###########################################
# Mirror to RAID1 conversion
###########################################

View File

@ -490,7 +490,7 @@ static int _read_params(struct lvconvert_params *lp, struct cmd_context *cmd,
return 0;
}
lp->segtype = get_segtype_from_string(cmd, arg_str_value(cmd, type_ARG, "mirror"));
lp->segtype = get_segtype_from_string(cmd, arg_str_value(cmd, type_ARG, find_config_tree_str(cmd, global_mirror_segtype_default_CFG)));
if (!lp->segtype)
return_0;
}