1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-11 20:58:50 +03:00

tests: make test complaint to local dev dir

For test running in 'local' dev dir we want to see loop devices there.
Also add missing notification to lvmetad after wipefs.
This commit is contained in:
Zdenek Kabelac 2021-02-24 11:54:24 +01:00
parent 7528a33630
commit 8d3ce32880

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Copyright (C) 2019 Red Hat, Inc. All rights reserved. # Copyright (C) 2019-2021 Red Hat, Inc. All rights reserved.
# #
# This copyrighted material is made available to anyone wishing to use, # This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions # modify, copy, or redistribute it subject to the terms and conditions
@ -15,32 +15,44 @@ SKIP_WITH_LVMPOLLD=1
. lib/inittest . lib/inittest
losetup -h | grep sector-size || skip losetup -h | grep sector-size || skip
which fallocate || skip
which wipefs || skip
dd if=/dev/zero of=loopa bs=$((1024*1024)) count=2 2> /dev/null fallocate -l 2M loopa
dd if=/dev/zero of=loopb bs=$((1024*1024)) count=2 2> /dev/null fallocate -l 2M loopb
LOOP1=$(losetup -f loopa --sector-size 4096 --show) LOOP1=$(losetup -f loopa --sector-size 4096 --show)
LOOP2=$(losetup -f loopb --show) LOOP2=$(losetup -f loopb --show)
echo $LOOP1 # prepare devX mapping so it works for real & fake dev dir
echo $LOOP2 d=1
for i in "$LOOP1" "$LOOP2"; do
echo "$i"
m=${i##*loop}
test -e "$DM_DEV_DIR/loop$m" || mknod "$DM_DEV_DIR/loop$m" b 7 "$m"
eval "dev$d=\"$DM_DEV_DIR/loop$m\""
d=$(( d + 1 ))
done
aux extend_filter "a|$LOOP1|" aux extend_filter "a|$dev1|" "a|$dev2|"
aux extend_filter "a|$LOOP2|"
not vgcreate --config 'devices {allow_mixed_block_sizes=0 scan="/dev"}' $vg $LOOP1 $LOOP2 not vgcreate --config 'devices/allow_mixed_block_sizes=0' $vg "$dev1" "$dev2"
vgcreate --config 'devices {allow_mixed_block_sizes=1 scan="/dev"}' $vg $LOOP1 $LOOP2 vgcreate --config 'devices/allow_mixed_block_sizes=1' $vg "$dev1" "$dev2"
vgs --config 'devices {allow_mixed_block_sizes=1 scan="/dev"}' $vg vgs --config 'devices/allow_mixed_block_sizes=1' $vg
aux wipefs_a $LOOP1 for i in "$dev1" "$dev2" ; do
aux wipefs_a $LOOP2 wipefs -a "$i"
# FIXME - we are not missing notification for hinting
# likely in more places - as the test should be able to work without
# system's udev working only on real /dev dir.
# aux notify_lvmetad "$i"
done
vgcreate --config 'devices {allow_mixed_block_sizes=1 scan="/dev"}' $vg $LOOP1 vgcreate --config 'devices/allow_mixed_block_sizes=1' $vg "$dev1"
vgs --config 'devices {allow_mixed_block_sizes=1 scan="/dev"}' $vg vgs --config 'devices/allow_mixed_block_sizes=1' $vg
not vgextend --config 'devices {allow_mixed_block_sizes=0 scan="/dev"}' $vg $LOOP2 not vgextend --config 'devices/allow_mixed_block_sizes=0' $vg "$dev2"
vgextend --config 'devices {allow_mixed_block_sizes=1 scan="/dev"}' $vg $LOOP2 vgextend --config 'devices/allow_mixed_block_sizes=1' $vg "$dev2"
losetup -d $LOOP1 losetup -d "$LOOP1"
losetup -d $LOOP2 losetup -d "$LOOP2"
rm loopa rm loopa
rm loopb rm loopb