mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
tests: play better with mdadm
Manage mdadm devices on older distros is a challange.
This commit is contained in:
parent
88421c883e
commit
7a5a4f952e
@ -427,7 +427,19 @@ prepare_md_dev() {
|
||||
mddev=/dev/md/md_lvm_test0 || \
|
||||
mddev=/dev/md_lvm_test0
|
||||
|
||||
mdadm --create --metadata=1.0 "$mddev" --auto=md --level $level --chunk $rchunk --raid-devices=$rdevs "${@:4}"
|
||||
mdadm --create --metadata=1.0 "$mddev" --auto=md --level $level --chunk $rchunk --raid-devices=$rdevs "${@:4}" || {
|
||||
# Some older 'mdadm' version managed to open and close devices internaly
|
||||
# and reporting non-exclusive access on such device
|
||||
# let's just skip the test if this happens.
|
||||
# Note: It's pretty complex to get rid of consequences
|
||||
# the following sequence avoid leaks on f19
|
||||
# TODO: maybe try here to recreate few times....
|
||||
mdadm --stop "$mddev" || true
|
||||
udev_wait
|
||||
mdadm --zero-superblock "${@:4}" || true
|
||||
udev_wait
|
||||
skip "Test skipped, unreliable mdadm detected!"
|
||||
}
|
||||
test -b "$mddev" || skip "mdadm has not created device!"
|
||||
|
||||
# LVM/DM will see this device
|
||||
|
@ -50,6 +50,7 @@ if aux kernel_at_least 2 6 33 ; then
|
||||
pvcreate --metadatasize 128k \
|
||||
--config 'devices { md_chunk_alignment=0 }' "$pvdev"
|
||||
check pv_field "$pvdev" pe_start "1.00m"
|
||||
pvremove "$pvdev"
|
||||
fi
|
||||
|
||||
# partition MD array directly, depends on blkext in Linux >= 2.6.28
|
||||
@ -58,6 +59,12 @@ if aux kernel_at_least 2 6 28 ; then
|
||||
sfdisk "$mddev" <<EOF
|
||||
,,83
|
||||
EOF
|
||||
# Wait till all partition links in udev are created
|
||||
aux udev_wait
|
||||
|
||||
# Skip test if udev rule has not created proper links for partitions
|
||||
test -b "${mddev}p1" || { ls -laR /dev ; skip "Missing partition link" ; }
|
||||
|
||||
pvscan
|
||||
# make sure partition on MD is _not_ removed
|
||||
# - tests partition -> parent lookup via sysfs paths
|
||||
|
Loading…
Reference in New Issue
Block a user