2019-08-01 18:13:41 +03:00
#!/usr/bin/env bash
2021-02-24 13:54:24 +03:00
# Copyright (C) 2019-2021 Red Hat, Inc. All rights reserved.
2019-08-01 18:13:41 +03:00
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2023-04-23 20:17:08 +03:00
SKIP_WITH_LVMLOCKD = 1
2019-08-01 18:13:41 +03:00
SKIP_WITH_LVMPOLLD = 1
. lib/inittest
2019-09-11 21:52:51 +03:00
losetup -h | grep sector-size || skip
2021-02-24 13:54:24 +03:00
which fallocate || skip
2019-09-11 21:52:51 +03:00
2021-02-24 13:54:24 +03:00
fallocate -l 2M loopa
fallocate -l 2M loopb
2021-03-27 23:59:23 +03:00
# Fight a weird occasional race in losetup usage:
#
# losetup: loopa: failed to set up loop device: Resource temporarily unavailable
# loop0: detected capacity change from 0 to 4096
# loop_set_block_size: loop0 () has still dirty pages (nrpages=2)
for i in { 1..5} ; do
LOOP1 = $( losetup -f loopa --sector-size 4096 --show || true )
test -n " $LOOP1 " && break
done
for i in { 1..5} ; do
LOOP2 = $( losetup -f loopb --show || true )
test -n " $LOOP2 " && break
done
2019-08-01 18:13:41 +03:00
2021-02-24 13:54:24 +03:00
# prepare devX mapping so it works for real & fake dev dir
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| $dev1 | " " a| $dev2 | "
2021-08-19 00:23:48 +03:00
aux extend_devices " $dev1 " " $dev2 "
2021-02-24 13:54:24 +03:00
not vgcreate --config 'devices/allow_mixed_block_sizes=0' $vg " $dev1 " " $dev2 "
vgcreate --config 'devices/allow_mixed_block_sizes=1' $vg " $dev1 " " $dev2 "
vgs --config 'devices/allow_mixed_block_sizes=1' $vg
for i in " $dev1 " " $dev2 " ; do
2021-03-11 12:46:31 +03:00
aux wipefs_a " $i "
2021-02-24 13:54:24 +03:00
# 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' $vg " $dev1 "
vgs --config 'devices/allow_mixed_block_sizes=1' $vg
not vgextend --config 'devices/allow_mixed_block_sizes=0' $vg " $dev2 "
vgextend --config 'devices/allow_mixed_block_sizes=1' $vg " $dev2 "
losetup -d " $LOOP1 "
losetup -d " $LOOP2 "
2019-08-01 18:13:41 +03:00
rm loopa
rm loopb