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

tests: integrity-caching: ensure raid redundancy

The recent fix 05c2b10c5d ensures that raid LV images are not
using the same devices.  This was happening in the lvextend commands
used by this test, so fix the test to use more devices to ensue
redundancy.
This commit is contained in:
David Teigland 2023-05-17 14:15:25 -05:00
parent 3a75704756
commit 24e4b6df11
2 changed files with 20 additions and 8 deletions

View File

@ -4471,10 +4471,13 @@ static int _lv_raid_redundant(struct logical_volume *lv,
for (s = 0; s < seg->area_count; s++) { for (s = 0; s < seg->area_count; s++) {
struct logical_volume *slv = meta ? seg_metalv(seg, s) : seg_lv(seg, s); struct logical_volume *slv = meta ? seg_metalv(seg, s) : seg_lv(seg, s);
if (slv && lv_is_on_pv(slv, pvl->pv) && nlvs++) if (slv && lv_is_on_pv(slv, pvl->pv) && nlvs++) {
log_error("LV %s using PV %s is not redundant.",
display_lvname(slv), dev_name(pvl->pv->dev));
return 0; return 0;
} }
} }
}
return 1; return 1;
} }

View File

@ -23,7 +23,7 @@ aux kernel_at_least 5 10 || export LVM_TEST_PREFER_BRD=0
mnt="mnt" mnt="mnt"
mkdir -p $mnt mkdir -p $mnt
aux prepare_devs 6 80 aux prepare_devs 9 80
# Use awk instead of anoyingly long log out from printf # Use awk instead of anoyingly long log out from printf
#printf "%0.sA" {1..16384} >> fileA #printf "%0.sA" {1..16384} >> fileA
@ -276,7 +276,7 @@ vgremove -ff $vg
# Test lvextend while inactive # Test lvextend while inactive
_prepare_vg _prepare_vg
lvcreate --type raid1 -m1 --raidintegrity y -n $lv1 -l 8 $vg lvcreate --type raid1 -m1 --raidintegrity y -n $lv1 -l 8 $vg "$dev1" "$dev2"
aux wait_recalc $vg/${lv1}_rimage_0 aux wait_recalc $vg/${lv1}_rimage_0
aux wait_recalc $vg/${lv1}_rimage_1 aux wait_recalc $vg/${lv1}_rimage_1
aux wait_recalc $vg/$lv1 aux wait_recalc $vg/$lv1
@ -286,7 +286,11 @@ lvs -a -o name,size,segtype,devices,sync_percent $vg
_add_new_data_to_mnt _add_new_data_to_mnt
umount $mnt umount $mnt
lvchange -an $vg/$lv1 lvchange -an $vg/$lv1
lvextend -l 16 $vg/$lv1 # use two new devs for raid extend to ensure redundancy
vgextend $vg "$dev7" "$dev8"
lvs -a -o name,segtype,devices $vg
lvextend -l 16 $vg/$lv1 "$dev7" "$dev8"
lvs -a -o name,segtype,devices $vg
lvchange -ay $vg/$lv1 lvchange -ay $vg/$lv1
mount "$DM_DEV_DIR/$vg/$lv1" $mnt mount "$DM_DEV_DIR/$vg/$lv1" $mnt
resize2fs "$DM_DEV_DIR/$vg/$lv1" resize2fs "$DM_DEV_DIR/$vg/$lv1"
@ -303,15 +307,18 @@ vgremove -ff $vg
# Test lvextend while active # Test lvextend while active
_prepare_vg _prepare_vg
lvcreate --type raid1 -m1 --raidintegrity y -n $lv1 -l 8 $vg lvcreate --type raid1 -m1 --raidintegrity y -n $lv1 -l 8 $vg "$dev1" "$dev2"
aux wait_recalc $vg/${lv1}_rimage_0 aux wait_recalc $vg/${lv1}_rimage_0
aux wait_recalc $vg/${lv1}_rimage_1 aux wait_recalc $vg/${lv1}_rimage_1
aux wait_recalc $vg/$lv1 aux wait_recalc $vg/$lv1
lvcreate --type $create_type -n fast -l 4 -an $vg "$dev6" lvcreate --type $create_type -n fast -l 4 -an $vg "$dev6"
lvconvert -y --type $convert_type $convert_option fast $vg/$lv1 lvconvert -y --type $convert_type $convert_option fast $vg/$lv1
# use two new devs for raid extend to ensure redundancy
vgextend $vg "$dev7" "$dev8"
lvs -a -o name,size,segtype,devices,sync_percent $vg lvs -a -o name,size,segtype,devices,sync_percent $vg
_add_new_data_to_mnt _add_new_data_to_mnt
lvextend -l 16 $vg/$lv1 lvextend -l 16 $vg/$lv1 "$dev7" "$dev8"
lvs -a -o name,size,segtype,devices,sync_percent $vg
resize2fs "$DM_DEV_DIR/$vg/$lv1" resize2fs "$DM_DEV_DIR/$vg/$lv1"
aux wait_recalc $vg/${lv1}_${suffix}_rimage_0 aux wait_recalc $vg/${lv1}_${suffix}_rimage_0
aux wait_recalc $vg/${lv1}_${suffix}_rimage_1 aux wait_recalc $vg/${lv1}_${suffix}_rimage_1
@ -324,16 +331,18 @@ lvremove $vg/$lv1
vgremove -ff $vg vgremove -ff $vg
_prepare_vg _prepare_vg
lvcreate --type raid5 --raidintegrity y -n $lv1 -I4 -l 8 $vg lvcreate --type raid5 --raidintegrity y -n $lv1 -I4 -l 8 $vg "$dev1" "$dev2" "$dev3"
aux wait_recalc $vg/${lv1}_rimage_0 aux wait_recalc $vg/${lv1}_rimage_0
aux wait_recalc $vg/${lv1}_rimage_1 aux wait_recalc $vg/${lv1}_rimage_1
aux wait_recalc $vg/${lv1}_rimage_2 aux wait_recalc $vg/${lv1}_rimage_2
aux wait_recalc $vg/$lv1 aux wait_recalc $vg/$lv1
lvcreate --type $create_type -n fast -l 4 -an $vg "$dev6" lvcreate --type $create_type -n fast -l 4 -an $vg "$dev6"
lvconvert -y --type $convert_type $convert_option fast $vg/$lv1 lvconvert -y --type $convert_type $convert_option fast $vg/$lv1
vgextend $vg "$dev7" "$dev8" "$dev9"
lvs -a -o name,size,segtype,devices,sync_percent $vg lvs -a -o name,size,segtype,devices,sync_percent $vg
_add_new_data_to_mnt _add_new_data_to_mnt
lvextend -l 16 $vg/$lv1 lvextend -l 16 $vg/$lv1 "$dev7" "$dev8" "$dev9"
lvs -a -o name,size,segtype,devices,sync_percent $vg
resize2fs "$DM_DEV_DIR/$vg/$lv1" resize2fs "$DM_DEV_DIR/$vg/$lv1"
aux wait_recalc $vg/${lv1}_${suffix}_rimage_0 aux wait_recalc $vg/${lv1}_${suffix}_rimage_0
aux wait_recalc $vg/${lv1}_${suffix}_rimage_1 aux wait_recalc $vg/${lv1}_${suffix}_rimage_1