1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

tests: update aux raid support

For raid1  use chunksize as bitmap-chunk specification.
Always enforce usage of bitmap - getting comparable outcome
as lvm2 raid support uses.
Add udev_wait after stopping  md array - as in fact leg-device
are still in use by target even command has finished.

(mdadm --stop causes WATCH rule wakeup, and
ioctl(STOP_ARRAY) returns IMHO to early - it should finish
and fsync work on leg devices first).
This commit is contained in:
Zdenek Kabelac 2016-05-05 21:00:42 +02:00
parent 7bb39af036
commit 07c1694ff5

View File

@ -659,6 +659,8 @@ prepare_md_dev() {
rm -f debug.log strace.log MD_DEV MD_DEV_PV MD_DEVICES rm -f debug.log strace.log MD_DEV MD_DEV_PV MD_DEVICES
coption="--chunk"
test "$level" = "1" && coption="--bitmap-chunk"
# Have MD use a non-standard name to avoid colliding with an existing MD device # Have MD use a non-standard name to avoid colliding with an existing MD device
# - mdadm >= 3.0 requires that non-standard device names be in /dev/md/ # - mdadm >= 3.0 requires that non-standard device names be in /dev/md/
# - newer mdadm _completely_ defers to udev to create the associated device node # - newer mdadm _completely_ defers to udev to create the associated device node
@ -668,7 +670,7 @@ prepare_md_dev() {
mddev=/dev/md/md_lvm_test0 || \ mddev=/dev/md/md_lvm_test0 || \
mddev=/dev/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 --bitmap=internal $coption=$rchunk --raid-devices=$rdevs "${@:4}" || {
# Some older 'mdadm' version managed to open and close devices internaly # Some older 'mdadm' version managed to open and close devices internaly
# and reporting non-exclusive access on such device # and reporting non-exclusive access on such device
# let's just skip the test if this happens. # let's just skip the test if this happens.
@ -707,6 +709,7 @@ cleanup_md_dev() {
mdadm --stop "$dev" || true mdadm --stop "$dev" || true
test "$DM_DEV_DIR" != "/dev" && rm -f "$DM_DEV_DIR/$(basename $dev)" test "$DM_DEV_DIR" != "/dev" && rm -f "$DM_DEV_DIR/$(basename $dev)"
notify_lvmetad $(< MD_DEV_PV) notify_lvmetad $(< MD_DEV_PV)
udev_wait # wait till events are process, not zeroing to early
for dev in $(< MD_DEVICES); do for dev in $(< MD_DEVICES); do
mdadm --zero-superblock "$dev" || true mdadm --zero-superblock "$dev" || true
notify_lvmetad "$dev" notify_lvmetad "$dev"