1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

test: Fix fallout from pv_read changes.

This commit is contained in:
Petr Rockai 2013-02-19 01:56:51 +01:00
parent d17cbf112b
commit 93108125ac
2 changed files with 22 additions and 15 deletions

View File

@ -21,5 +21,5 @@ vgcreate --metadatasize 128k $vg1 "$dev1"
dd if="$dev1" of="$dev2" bs=256K count=1 dd if="$dev1" of="$dev2" bs=256K count=1
dd if="$dev1" of="$dev3" bs=256K count=1 dd if="$dev1" of="$dev3" bs=256K count=1
pvs "$dev1" pvs "$dev3"
vgs $vg1 vgs $vg1

View File

@ -58,21 +58,24 @@ test -b "$mddev" && skip
mdadm --create --metadata=1.0 "$mddev" --auto=md --level 0 --raid-devices=2 --chunk 64 "$dev1" "$dev2" mdadm --create --metadata=1.0 "$mddev" --auto=md --level 0 --raid-devices=2 --chunk 64 "$dev1" "$dev2"
trap 'cleanup_md_and_teardown' EXIT # cleanup this MD device at the end of the test trap 'cleanup_md_and_teardown' EXIT # cleanup this MD device at the end of the test
test -b "$mddev" || skip test -b "$mddev" || skip
cp -LR "$mddev" "$DM_DEV_DIR" # so that LVM/DM can see the device
lvmdev="$DM_DEV_DIR/md_lvm_test0"
# Test alignment of PV on MD without any MD-aware or topology-aware detection # Test alignment of PV on MD without any MD-aware or topology-aware detection
# - should treat $mddev just like any other block device # - should treat $mddev just like any other block device
pv_align="1.00m" pv_align="1.00m"
pvcreate --metadatasize 128k \ pvcreate --metadatasize 128k \
--config 'devices {md_chunk_alignment=0 data_alignment_detection=0 data_alignment_offset_detection=0}' \ --config 'devices {md_chunk_alignment=0 data_alignment_detection=0 data_alignment_offset_detection=0}' \
"$mddev" "$lvmdev"
check pv_field "$mddev" pe_start $pv_align
check pv_field "$lvmdev" pe_start $pv_align
# Test md_chunk_alignment independent of topology-aware detection # Test md_chunk_alignment independent of topology-aware detection
pv_align="1.00m" pv_align="1.00m"
pvcreate --metadatasize 128k \ pvcreate --metadatasize 128k \
--config 'devices {data_alignment_detection=0 data_alignment_offset_detection=0}' \ --config 'devices {data_alignment_detection=0 data_alignment_offset_detection=0}' \
"$mddev" "$lvmdev"
check pv_field "$mddev" pe_start $pv_align check pv_field "$lvmdev" pe_start $pv_align
# Test newer topology-aware alignment detection # Test newer topology-aware alignment detection
@ -81,8 +84,8 @@ if kernel_at_least 2 6 33 ; then
pv_align="1.00m" pv_align="1.00m"
# optimal_io_size=131072, minimum_io_size=65536 # optimal_io_size=131072, minimum_io_size=65536
pvcreate --metadatasize 128k \ pvcreate --metadatasize 128k \
--config 'devices { md_chunk_alignment=0 }' "$mddev" --config 'devices { md_chunk_alignment=0 }' "$lvmdev"
check pv_field "$mddev" pe_start $pv_align check pv_field "$lvmdev" pe_start $pv_align
fi fi
# partition MD array directly, depends on blkext in Linux >= 2.6.28 # partition MD array directly, depends on blkext in Linux >= 2.6.28
@ -91,9 +94,10 @@ if kernel_at_least 2 6 28 ; then
sfdisk "$mddev" <<EOF sfdisk "$mddev" <<EOF
,,83 ,,83
EOF EOF
pvscan
# make sure partition on MD is _not_ removed # make sure partition on MD is _not_ removed
# - tests partition -> parent lookup via sysfs paths # - tests partition -> parent lookup via sysfs paths
not pvcreate --metadatasize 128k "$mddev" not pvcreate --metadatasize 128k "$lvmdev"
# verify alignment_offset is accounted for in pe_start # verify alignment_offset is accounted for in pe_start
# - topology infrastructure is available in Linux >= 2.6.31 # - topology infrastructure is available in Linux >= 2.6.31
@ -109,6 +113,8 @@ EOF
# wait here for created device node on tmpfs # wait here for created device node on tmpfs
aux udev_wait "$mddev_p" aux udev_wait "$mddev_p"
test -b "$mddev_p" || skip test -b "$mddev_p" || skip
cp -LR "$mddev_p" "$DM_DEV_DIR"
lvmdev_p="$DM_DEV_DIR/$base_mddev_p"
# Checking for 'alignment_offset' in sysfs implies Linux >= 2.6.31 # Checking for 'alignment_offset' in sysfs implies Linux >= 2.6.31
# but reliable alignment_offset support requires kernel.org Linux >= 2.6.33 # but reliable alignment_offset support requires kernel.org Linux >= 2.6.33
@ -120,9 +126,9 @@ EOF
if [ $alignment_offset -gt 0 ]; then if [ $alignment_offset -gt 0 ]; then
# default alignment is 1M, add alignment_offset # default alignment is 1M, add alignment_offset
pv_align=$((1048576+$alignment_offset))B pv_align=$((1048576+$alignment_offset))B
pvcreate --metadatasize 128k "$mddev_p" pvcreate --metadatasize 128k "$lvmdev_p"
check pv_field "$mddev_p" pe_start $pv_align --units b check pv_field "$lvmdev_p" pe_start $pv_align --units b
pvremove "$mddev_p" pvremove "$lvmdev_p"
fi fi
fi fi
@ -140,12 +146,13 @@ if kernel_at_least 2 6 33 ; then
# optimal_io_size=2097152, minimum_io_size=1048576 # optimal_io_size=2097152, minimum_io_size=1048576
pv_align="2.00m" pv_align="2.00m"
pvcreate --metadatasize 128k \ pvcreate --metadatasize 128k \
--config 'devices { md_chunk_alignment=0 }' "$mddev" --config 'devices { md_chunk_alignment=0 }' "$lvmdev"
check pv_field "$mddev" pe_start $pv_align pvscan # Something is seriously broken.
check pv_field "$lvmdev" pe_start $pv_align
# now verify pe_start alignment override using --dataalignment # now verify pe_start alignment override using --dataalignment
pv_align="192.00k" pv_align="192.00k"
pvcreate --dataalignment 64k --metadatasize 128k \ pvcreate --dataalignment 64k --metadatasize 128k \
--config 'devices { md_chunk_alignment=0 }' "$mddev" --config 'devices { md_chunk_alignment=0 }' "$lvmdev"
check pv_field "$mddev" pe_start $pv_align check pv_field "$lvmdev" pe_start $pv_align
fi fi