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

lvconvert: fix failing valid regionsize change

Reshape check failed when regionsize changed and current raid type
was provided with no other change requested (stripes or stripesize).

E.g. "lvconvert --type raid6 --regionsize 256K" on a raid6 LV
with != 256K regionsize.

Enable --type in test script.
This commit is contained in:
Heinz Mauelshagen 2017-04-12 14:38:49 +02:00
parent 01b5820d03
commit 532388fad5
2 changed files with 5 additions and 7 deletions

View File

@ -2389,7 +2389,7 @@ static int _reshape_requested(const struct logical_volume *lv, const struct segm
if (seg_is_any_raid10(seg) && seg->area_count > 2 &&
stripes && stripes < seg->area_count - seg->segtype->parity_devs) {
log_error("Can't remove stripes from raid10");
goto err;
return 2;
}
if (data_copies != seg->data_copies) {
@ -2400,22 +2400,20 @@ static int _reshape_requested(const struct logical_volume *lv, const struct segm
/* Change layout (e.g. raid5_ls -> raid5_ra) keeping # of stripes */
if (seg->segtype != segtype) {
if (stripes && stripes != _data_rimages_count(seg, seg->area_count))
goto err;
return 2;
return 1;
}
if (stripes && stripes == _data_rimages_count(seg, seg->area_count) &&
stripe_size == seg->stripe_size) {
stripe_size == seg->stripe_size &&
region_size == seg->region_size) {
log_error("LV %s already has %u stripes.",
display_lvname(lv), stripes);
return 2;
}
return (stripes || stripe_size) ? 1 : 0;
err:
return 2;
}
/*

View File

@ -27,7 +27,7 @@ function _test_regionsize
local vg=$4
local lv=$5
lvconvert --yes -R $regionsize $vg/$lv
lvconvert --type $type --yes -R $regionsize $vg/$lv
[ $? -ne 0 ] && return 1
check lv_field $vg/$lv regionsize "$regionsize_str"
fsck -fn "$DM_DEV_DIR/$vg/$lv"