mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-19 14:04:17 +03:00
Update test for dmevent restart
Actually restart was failing for different reason - so pass in proper location of dmeventd for restart from lvm command and avoid using the one from /sbin location. Update pv create test with "" around path.
This commit is contained in:
parent
37672e676d
commit
758f674240
@ -11,15 +11,8 @@
|
|||||||
|
|
||||||
. lib/test
|
. lib/test
|
||||||
|
|
||||||
which mkfs.ext2 || skip
|
|
||||||
|
|
||||||
aux prepare_dmeventd
|
aux prepare_dmeventd
|
||||||
|
|
||||||
# Currently dmeventd doesn't support any other location
|
|
||||||
# for dmeventd restart, so FIXME in dmeventd
|
|
||||||
# and update this check
|
|
||||||
test -x /sbin/dmeventd || skip
|
|
||||||
|
|
||||||
aux prepare_vg 5
|
aux prepare_vg 5
|
||||||
|
|
||||||
lvcreate -m 3 --ig -L 1 -n 4way $vg
|
lvcreate -m 3 --ig -L 1 -n 4way $vg
|
||||||
@ -28,9 +21,8 @@ lvcreate -m 2 --ig -L 1 -n 3way $vg
|
|||||||
lvchange --monitor y $vg/3way
|
lvchange --monitor y $vg/3way
|
||||||
|
|
||||||
dmeventd -R -f &
|
dmeventd -R -f &
|
||||||
echo "$!" > LOCAL_DMEVENTD
|
echo $! >LOCAL_DMEVENTD
|
||||||
|
sleep 2 # wait a bit, so we talk to the new dmeventd later
|
||||||
sleep 1 # wait a bit, so we talk to the new dmeventd later
|
|
||||||
|
|
||||||
lvchange --monitor y --verbose $vg/3way 2>&1 | tee lvchange.out
|
lvchange --monitor y --verbose $vg/3way 2>&1 | tee lvchange.out
|
||||||
grep 'already monitored' lvchange.out
|
grep 'already monitored' lvchange.out
|
||||||
@ -40,9 +32,15 @@ grep 'already monitored' lvchange.out
|
|||||||
# now try what happens if no dmeventd is running
|
# now try what happens if no dmeventd is running
|
||||||
kill -9 $(cat LOCAL_DMEVENTD)
|
kill -9 $(cat LOCAL_DMEVENTD)
|
||||||
dmeventd -R -f &
|
dmeventd -R -f &
|
||||||
sleep 3
|
sleep 1
|
||||||
|
# now dmeventd should not be running
|
||||||
|
pgrep dmeventd
|
||||||
|
rm LOCAL_DMEVENTD
|
||||||
|
|
||||||
|
# set dmeventd path
|
||||||
|
aux lvmconf "dmeventd/executable=\"$abs_top_builddir/test/lib/dmeventd\""
|
||||||
lvchange --monitor y --verbose $vg/3way 2>&1 | tee lvchange.out
|
lvchange --monitor y --verbose $vg/3way 2>&1 | tee lvchange.out
|
||||||
not grep 'already monitored' lvchange.out
|
|
||||||
pgrep dmeventd >LOCAL_DMEVENTD
|
pgrep dmeventd >LOCAL_DMEVENTD
|
||||||
|
not grep 'already monitored' lvchange.out
|
||||||
|
|
||||||
vgremove -ff $vg
|
vgremove -ff $vg
|
||||||
|
@ -37,12 +37,12 @@ cleanup_md() {
|
|||||||
# sleeps offer hack to defeat: 'md: md127 still in use'
|
# sleeps offer hack to defeat: 'md: md127 still in use'
|
||||||
# see: https://bugzilla.redhat.com/show_bug.cgi?id=509908#c25
|
# see: https://bugzilla.redhat.com/show_bug.cgi?id=509908#c25
|
||||||
aux udev_wait
|
aux udev_wait
|
||||||
mdadm --stop $mddev || true
|
mdadm --stop "$mddev" || true
|
||||||
aux udev_wait
|
aux udev_wait
|
||||||
if [ -b "$mddev" ]; then
|
if [ -b "$mddev" ]; then
|
||||||
# mdadm doesn't always cleanup the device node
|
# mdadm doesn't always cleanup the device node
|
||||||
sleep 2
|
sleep 2
|
||||||
rm -f $mddev
|
rm -f "$mddev"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ cleanup_md_and_teardown() {
|
|||||||
|
|
||||||
# create 2 disk MD raid0 array (stripe_width=128K)
|
# create 2 disk MD raid0 array (stripe_width=128K)
|
||||||
test -b "$mddev" && skip
|
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
|
||||||
|
|
||||||
@ -62,15 +62,15 @@ test -b "$mddev" || skip
|
|||||||
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
|
"$mddev"
|
||||||
check pv_field $mddev pe_start $pv_align
|
check pv_field "$mddev" 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
|
"$mddev"
|
||||||
check pv_field $mddev pe_start $pv_align
|
check pv_field "$mddev" pe_start $pv_align
|
||||||
|
|
||||||
|
|
||||||
# Test newer topology-aware alignment detection
|
# Test newer topology-aware alignment detection
|
||||||
@ -79,34 +79,34 @@ 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 }' "$mddev"
|
||||||
check pv_field $mddev pe_start $pv_align
|
check pv_field "$mddev" 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
|
||||||
if kernel_at_least 2 6 28 ; then
|
if kernel_at_least 2 6 28 ; then
|
||||||
# create one partition
|
# create one partition
|
||||||
sfdisk $mddev <<EOF
|
sfdisk "$mddev" <<EOF
|
||||||
,,83
|
,,83
|
||||||
EOF
|
EOF
|
||||||
# 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 "$mddev"
|
||||||
|
|
||||||
# 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
|
||||||
# - also tests partition -> parent lookup via sysfs paths
|
# - also tests partition -> parent lookup via sysfs paths
|
||||||
|
|
||||||
# Oh joy: need to lookup /sys/block/md127 rather than /sys/block/md_lvm_test0
|
# Oh joy: need to lookup /sys/block/md127 rather than /sys/block/md_lvm_test0
|
||||||
mddev_maj_min=$(ls -lL $mddev | awk '{ print $5 $6 }' | perl -pi -e 's|,|:|')
|
mddev_maj_min=$(ls -lL "$mddev" | awk '{ print $5 $6 }' | perl -pi -e 's|,|:|')
|
||||||
mddev_p_sysfs_name=$(echo /sys/dev/block/${mddev_maj_min}/*p1)
|
mddev_p_sysfs_name=$(echo /sys/dev/block/${mddev_maj_min}/*p1)
|
||||||
base_mddev_p=`basename $mddev_p_sysfs_name`
|
base_mddev_p=`basename $mddev_p_sysfs_name`
|
||||||
mddev_p=/dev/${base_mddev_p}
|
mddev_p=/dev/${base_mddev_p}
|
||||||
|
|
||||||
# in case the system is running without devtmpfs /dev
|
# in case the system is running without devtmpfs /dev
|
||||||
# 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
|
||||||
|
|
||||||
# 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
|
||||||
@ -118,9 +118,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 "$mddev_p"
|
||||||
check pv_field $mddev_p pe_start $pv_align --units b
|
check pv_field "$mddev_p" pe_start $pv_align --units b
|
||||||
pvremove $mddev_p
|
pvremove "$mddev_p"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -132,18 +132,18 @@ if kernel_at_least 2 6 33 ; then
|
|||||||
|
|
||||||
# create 2 disk MD raid0 array (stripe_width=2M)
|
# create 2 disk MD raid0 array (stripe_width=2M)
|
||||||
test -b "$mddev" && skip
|
test -b "$mddev" && skip
|
||||||
mdadm --create --metadata=1.0 $mddev --auto=md --level 0 --raid-devices=2 --chunk 1024 "$dev1" "$dev2"
|
mdadm --create --metadata=1.0 "$mddev" --auto=md --level 0 --raid-devices=2 --chunk 1024 "$dev1" "$dev2"
|
||||||
test -b "$mddev" || skip
|
test -b "$mddev" || skip
|
||||||
|
|
||||||
# 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 }' "$mddev"
|
||||||
check pv_field $mddev pe_start $pv_align
|
check pv_field "$mddev" 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 }' "$mddev"
|
||||||
check pv_field $mddev pe_start $pv_align
|
check pv_field "$mddev" pe_start $pv_align
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user