1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-18 10:04:20 +03:00

tests: convert to use mdadm_create

Flip usage from prepare_md_dev to mdadm_create.
This commit is contained in:
Zdenek Kabelac 2021-03-22 22:23:53 +01:00
parent b1483dcbac
commit a7d7471906

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Copyright (C) 2018 Red Hat, Inc. All rights reserved. # Copyright (C) 2018-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
@ -26,16 +26,17 @@ aux extend_filter_LVMTEST "a|/dev/md|"
aux prepare_devs 4 aux prepare_devs 4
pvcreate "$dev2" pvcreate "$dev2"
aux prepare_md_dev 0 64 2 "$dev1" "$dev2"
# Incorrectly shows $dev2 as PV for 'raid0'
pvs -vvvv
aux mdadm_create --metadata=1.0 --level=0 --chunk=64 --raid-devices=2 "$dev1" "$dev2"
pvs | tee out
not grep pv2 out
vgcreate $SHARED $vg "$dev3" "$dev4" vgcreate $SHARED $vg "$dev3" "$dev4"
# create 2 disk MD raid1 array # create 2 disk MD raid1 array
# by default using metadata format 1.0 with data at the end of device # by default using metadata format 1.0 with data at the end of device
aux prepare_md_dev 1 64 2 "$dev1" "$dev2" aux mdadm_create --metadata=1.0 --level=1 --chunk=64 --raid-devices=2 "$dev1" "$dev2"
mddev=$(< MD_DEV) mddev=$(< MD_DEV)
pvdev=$(< MD_DEV_PV) pvdev=$(< MD_DEV_PV)
@ -51,8 +52,8 @@ vgremove -f $vg
sleep 3 sleep 3
aux udev_wait aux udev_wait
# too bad 'dd' wakes up md array reassembling # too bad 'dd' wakes up md array reassembling
should not mdadm --detail "$mddev" mdadm --detail "$mddev" || true
should not mdadm --stop "$mddev" mdadm --stop "$mddev" || true
sleep 3 sleep 3
# print what blkid thinks about each PV # print what blkid thinks about each PV
@ -64,12 +65,12 @@ done
# expect open count for each PV to be 0 # expect open count for each PV to be 0
dmsetup info -c dmsetup info -c
pvs -vvvv "$dev2" "$dev3" || true pvs "$dev2" "$dev3" || true
# still expect open count for each PV to be 0 # still expect open count for each PV to be 0
dmsetup info -c dmsetup info -c
pvs -vvvv "$dev3" "$dev2" || true pvs "$dev3" "$dev2" || true
# and again we expect open count for each PV to be 0 # and again we expect open count for each PV to be 0
dmsetup info -c dmsetup info -c
@ -97,5 +98,5 @@ if mdadm --action=repair "$mddev" ; then
sleep 1 sleep 1
pvscan -vvvv pvscan -vvvv
# should be showing correctly PV3 & PV4 # should be showing correctly PV3 & PV4
pvs -vvvv "$dev3" "$dev4" pvs "$dev3" "$dev4"
fi fi