1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

tests: use standard md devices

This commit is contained in:
David Teigland 2019-09-11 13:26:41 -05:00
parent 772dbb1e39
commit 1fe04f89ef
5 changed files with 169 additions and 114 deletions

View File

@ -775,6 +775,20 @@ cleanup_md_dev() {
rm -f MD_DEV MD_DEVICES MD_DEV_PV rm -f MD_DEV MD_DEVICES MD_DEV_PV
} }
wait_md_create() {
local md=$1
while :; do
if ! grep `basename $md` /proc/mdstat; then
echo "$md not ready"
cat /proc/mdstat
sleep 2
else
break
fi
done
}
prepare_backing_dev() { prepare_backing_dev() {
local size=${1=32} local size=${1=32}
shift shift
@ -1093,6 +1107,17 @@ extend_filter() {
lvmconf "$filter" "devices/scan_lvs = 1" lvmconf "$filter" "devices/scan_lvs = 1"
} }
extend_filter_md() {
local filter
filter=$(grep ^devices/global_filter CONFIG_VALUES | tail -n 1)
for rx in "$@"; do
filter=$(echo "$filter" | sed -e "s:\\[:[ \"$rx\", :")
done
lvmconf "$filter"
lvmconf "devices/scan = [ \"$DM_DEV_DIR\", \"/dev\" ]"
}
extend_filter_LVMTEST() { extend_filter_LVMTEST() {
extend_filter "a|$DM_DEV_DIR/$PREFIX|" "$@" extend_filter "a|$DM_DEV_DIR/$PREFIX|" "$@"
} }
@ -1165,7 +1190,7 @@ devices/dir = "$DM_DEV_DIR"
devices/filter = "a|.*|" devices/filter = "a|.*|"
devices/global_filter = [ "a|$DM_DEV_DIR/mapper/${PREFIX}.*pv[0-9_]*$|", "r|.*|" ] devices/global_filter = [ "a|$DM_DEV_DIR/mapper/${PREFIX}.*pv[0-9_]*$|", "r|.*|" ]
devices/md_component_detection = 0 devices/md_component_detection = 0
devices/scan = "$DM_DEV_DIR" devices/scan = [ "$DM_DEV_DIR" ]
devices/sysfs_scan = 1 devices/sysfs_scan = 1
devices/write_cache_state = 0 devices/write_cache_state = 0
global/abort_on_internal_errors = 1 global/abort_on_internal_errors = 1

View File

@ -11,6 +11,7 @@
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
SKIP_WITH_LVMPOLLD=1 SKIP_WITH_LVMPOLLD=1
SKIP_WITH_LVMLOCKD=1
RUNDIR="/run" RUNDIR="/run"
test -d "$RUNDIR" || RUNDIR="/var/run" test -d "$RUNDIR" || RUNDIR="/var/run"
@ -29,6 +30,7 @@ _clear_online_files() {
test -f /proc/mdstat && grep -q raid0 /proc/mdstat || \ test -f /proc/mdstat && grep -q raid0 /proc/mdstat || \
modprobe raid0 || skip modprobe raid0 || skip
not grep md0 /proc/mdstat
aux lvmconf 'devices/md_component_detection = 1' aux lvmconf 'devices/md_component_detection = 1'
@ -37,7 +39,7 @@ aux lvmconf 'devices/md_component_detection = 1'
# want to rely on that ability in this test. # want to rely on that ability in this test.
aux lvmconf 'devices/obtain_device_list_from_udev = 0' aux lvmconf 'devices/obtain_device_list_from_udev = 0'
aux extend_filter_LVMTEST "a|/dev/md|" aux extend_filter_md "a|/dev/md|"
aux prepare_devs 4 aux prepare_devs 4
@ -60,10 +62,9 @@ pvcreate "$dev3"
aux lvmconf 'devices/md_component_checks = "auto"' aux lvmconf 'devices/md_component_checks = "auto"'
aux prepare_md_dev 0 64 2 "$dev1" "$dev2" mddev="/dev/md0"
cat /proc/mdstat mdadm --create --metadata=1.0 "$mddev" --level 0 --chunk=64 --raid-devices=2 "$dev1" "$dev2"
mddev=$(< MD_DEV) aux wait_md_create "$mddev"
pvdev=$(< MD_DEV_PV)
pvcreate "$mddev" pvcreate "$mddev"
PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'` PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'`
echo $PVIDMD echo $PVIDMD
@ -119,7 +120,11 @@ not grep "active" out
vgchange -an $vg vgchange -an $vg
vgremove -f $vg vgremove -f $vg
aux cleanup_md_dev mdadm --stop "$mddev"
aux udev_wait
wipefs -a "$dev1"
wipefs -a "$dev2"
aux udev_wait
########################################## ##########################################
@ -130,10 +135,9 @@ aux cleanup_md_dev
aux lvmconf 'devices/md_component_checks = "start"' aux lvmconf 'devices/md_component_checks = "start"'
aux prepare_md_dev 0 64 2 "$dev1" "$dev2" mddev="/dev/md0"
cat /proc/mdstat mdadm --create --metadata=1.0 "$mddev" --level 0 --chunk=64 --raid-devices=2 "$dev1" "$dev2"
mddev=$(< MD_DEV) aux wait_md_create "$mddev"
pvdev=$(< MD_DEV_PV)
pvcreate "$mddev" pvcreate "$mddev"
PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'` PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'`
echo $PVIDMD echo $PVIDMD
@ -189,7 +193,11 @@ not grep "active" out
vgchange -an $vg vgchange -an $vg
vgremove -f $vg vgremove -f $vg
aux cleanup_md_dev mdadm --stop "$mddev"
aux udev_wait
wipefs -a "$dev1"
wipefs -a "$dev2"
aux udev_wait
########################################## ##########################################
@ -200,10 +208,9 @@ aux cleanup_md_dev
aux lvmconf 'devices/md_component_checks = "auto"' aux lvmconf 'devices/md_component_checks = "auto"'
aux prepare_md_dev 0 64 2 "$dev1" "$dev2" mddev="/dev/md0"
cat /proc/mdstat mdadm --create --metadata=1.0 "$mddev" --level 0 --chunk=64 --raid-devices=2 "$dev1" "$dev2"
mddev=$(< MD_DEV) aux wait_md_create "$mddev"
pvdev=$(< MD_DEV_PV)
pvcreate "$mddev" pvcreate "$mddev"
PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'` PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'`
echo $PVIDMD echo $PVIDMD
@ -245,7 +252,9 @@ pvscan --cache -aay "$dev2"
not ls "$RUNDIR/lvm/pvs_online/$PVIDMD" not ls "$RUNDIR/lvm/pvs_online/$PVIDMD"
not ls "$RUNDIR/lvm/vgs_online/$vg" not ls "$RUNDIR/lvm/vgs_online/$vg"
aux cleanup_md_dev wipefs -a "$dev1"
wipefs -a "$dev2"
aux udev_wait
########################################## ##########################################
# PV on an md raid0 device, start+stopped # PV on an md raid0 device, start+stopped
@ -255,11 +264,9 @@ aux cleanup_md_dev
aux lvmconf 'devices/md_component_checks = "start"' aux lvmconf 'devices/md_component_checks = "start"'
wipefs -a "$dev1" "$dev2" mddev="/dev/md0"
aux prepare_md_dev 0 64 2 "$dev1" "$dev2" mdadm --create --metadata=1.0 "$mddev" --level 0 --chunk=64 --raid-devices=2 "$dev1" "$dev2"
cat /proc/mdstat aux wait_md_create "$mddev"
mddev=$(< MD_DEV)
pvdev=$(< MD_DEV_PV)
pvcreate "$mddev" pvcreate "$mddev"
PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'` PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'`
echo $PVIDMD echo $PVIDMD
@ -304,7 +311,9 @@ not ls "$RUNDIR/lvm/vgs_online/$vg"
lvs -o active $vg |tee out || true lvs -o active $vg |tee out || true
not grep "active" out not grep "active" out
aux cleanup_md_dev wipefs -a "$dev1"
wipefs -a "$dev2"
aux udev_wait
########################################## ##########################################
@ -316,11 +325,9 @@ aux cleanup_md_dev
aux lvmconf 'devices/md_component_checks = "start"' aux lvmconf 'devices/md_component_checks = "start"'
wipefs -a "$dev1" "$dev2" mddev="/dev/md0"
aux prepare_md_dev 0 64 2 "$dev1" "$dev2" mdadm --create --metadata=1.0 "$mddev" --level 0 --chunk=64 --raid-devices=2 "$dev1" "$dev2"
cat /proc/mdstat aux wait_md_create "$mddev"
mddev=$(< MD_DEV)
pvdev=$(< MD_DEV_PV)
pvcreate "$mddev" pvcreate "$mddev"
PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'` PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'`
echo $PVIDMD echo $PVIDMD
@ -361,7 +368,7 @@ not ls "$RUNDIR/lvm/pvs_online/$PVIDMD"
not ls "$RUNDIR/lvm/vgs_online/$vg" not ls "$RUNDIR/lvm/vgs_online/$vg"
aux enable_dev "$dev2" aux enable_dev "$dev2"
aux udev_wait aux aux udev_wait
cat /proc/mdstat cat /proc/mdstat
# for some reason enabling dev2 starts an odd md dev # for some reason enabling dev2 starts an odd md dev
mdadm --stop "$mddev" || true mdadm --stop "$mddev" || true
@ -369,6 +376,7 @@ mdadm --stop --scan
cat /proc/mdstat cat /proc/mdstat
wipefs -a "$dev1" || true wipefs -a "$dev1" || true
wipefs -a "$dev2" || true wipefs -a "$dev2" || true
aux udev_wait
########################################## ##########################################
# PV on an md raid0 device, auto+stopped # PV on an md raid0 device, auto+stopped
@ -379,10 +387,9 @@ wipefs -a "$dev2" || true
aux lvmconf 'devices/md_component_checks = "auto"' aux lvmconf 'devices/md_component_checks = "auto"'
aux prepare_md_dev 0 64 2 "$dev1" "$dev2" mddev="/dev/md0"
cat /proc/mdstat mdadm --create --metadata=1.0 "$mddev" --level 0 --chunk=64 --raid-devices=2 "$dev1" "$dev2"
mddev=$(< MD_DEV) aux wait_md_create "$mddev"
pvdev=$(< MD_DEV_PV)
pvcreate "$mddev" pvcreate "$mddev"
PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'` PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'`
echo $PVIDMD echo $PVIDMD
@ -428,7 +435,7 @@ not ls "$RUNDIR/lvm/pvs_online/$PVIDMD"
not ls "$RUNDIR/lvm/vgs_online/$vg" not ls "$RUNDIR/lvm/vgs_online/$vg"
aux enable_dev "$dev2" aux enable_dev "$dev2"
aux udev_wait aux aux udev_wait
cat /proc/mdstat cat /proc/mdstat
# for some reason enabling dev2 starts an odd md dev # for some reason enabling dev2 starts an odd md dev
mdadm --stop "$mddev" || true mdadm --stop "$mddev" || true
@ -436,3 +443,4 @@ mdadm --stop --scan
cat /proc/mdstat cat /proc/mdstat
wipefs -a "$dev1" || true wipefs -a "$dev1" || true
wipefs -a "$dev2" || true wipefs -a "$dev2" || true
aux udev_wait

View File

@ -16,6 +16,7 @@
# . a single PV/VG cloned plus a dm wrapper (two separate dups of a PV) # . a single PV/VG cloned plus a dm wrapper (two separate dups of a PV)
SKIP_WITH_LVMPOLLD=1 SKIP_WITH_LVMPOLLD=1
SKIP_WITH_LVMLOCKD=1
RUNDIR="/run" RUNDIR="/run"
test -d "$RUNDIR" || RUNDIR="/var/run" test -d "$RUNDIR" || RUNDIR="/var/run"
@ -34,6 +35,7 @@ _clear_online_files() {
test -f /proc/mdstat && grep -q raid1 /proc/mdstat || \ test -f /proc/mdstat && grep -q raid1 /proc/mdstat || \
modprobe raid1 || skip modprobe raid1 || skip
not grep md0 /proc/mdstat
aux lvmconf 'devices/md_component_detection = 1' aux lvmconf 'devices/md_component_detection = 1'
@ -42,7 +44,7 @@ aux lvmconf 'devices/md_component_detection = 1'
# want to rely on that ability in this test. # want to rely on that ability in this test.
aux lvmconf 'devices/obtain_device_list_from_udev = 0' aux lvmconf 'devices/obtain_device_list_from_udev = 0'
aux extend_filter_LVMTEST "a|/dev/md|" aux extend_filter_md "a|/dev/md|"
aux prepare_devs 4 aux prepare_devs 4
@ -65,11 +67,9 @@ pvcreate "$dev3"
aux lvmconf 'devices/md_component_checks = "auto"' aux lvmconf 'devices/md_component_checks = "auto"'
aux prepare_md_dev 1 64 2 "$dev1" "$dev2" mddev="/dev/md0"
sleep 4 mdadm --create --metadata=1.0 "$mddev" --level 1 --chunk=64 --raid-devices=2 "$dev1" "$dev2"
cat /proc/mdstat aux wait_md_create "$mddev"
mddev=$(< MD_DEV)
pvdev=$(< MD_DEV_PV)
pvcreate "$mddev" pvcreate "$mddev"
PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'` PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'`
echo $PVIDMD echo $PVIDMD
@ -125,7 +125,12 @@ not grep "active" out
vgchange -an $vg vgchange -an $vg
vgremove -f $vg vgremove -f $vg
aux cleanup_md_dev mdadm --stop "$mddev"
aux udev_wait
wipefs -a "$dev1"
wipefs -a "$dev2"
aux udev_wait
########################################## ##########################################
@ -136,11 +141,9 @@ aux cleanup_md_dev
aux lvmconf 'devices/md_component_checks = "start"' aux lvmconf 'devices/md_component_checks = "start"'
aux prepare_md_dev 1 64 2 "$dev1" "$dev2" mddev="/dev/md0"
sleep 4 mdadm --create --metadata=1.0 "$mddev" --level 1 --chunk=64 --raid-devices=2 "$dev1" "$dev2"
cat /proc/mdstat aux wait_md_create "$mddev"
mddev=$(< MD_DEV)
pvdev=$(< MD_DEV_PV)
pvcreate "$mddev" pvcreate "$mddev"
PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'` PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'`
echo $PVIDMD echo $PVIDMD
@ -210,7 +213,11 @@ not pvscan --cache -aay "$dev1"
vgchange -an $vg vgchange -an $vg
vgremove -f $vg vgremove -f $vg
aux cleanup_md_dev mdadm --stop "$mddev"
aux udev_wait
wipefs -a "$dev1"
wipefs -a "$dev2"
aux udev_wait
########################################## ##########################################
@ -221,11 +228,9 @@ aux cleanup_md_dev
aux lvmconf 'devices/md_component_checks = "auto"' aux lvmconf 'devices/md_component_checks = "auto"'
aux prepare_md_dev 1 64 2 "$dev1" "$dev2" mddev="/dev/md0"
sleep 4 mdadm --create --metadata=1.0 "$mddev" --level 1 --chunk=64 --raid-devices=2 "$dev1" "$dev2"
cat /proc/mdstat aux wait_md_create "$mddev"
mddev=$(< MD_DEV)
pvdev=$(< MD_DEV_PV)
pvcreate "$mddev" pvcreate "$mddev"
PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'` PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'`
echo $PVIDMD echo $PVIDMD
@ -267,7 +272,10 @@ pvscan --cache -aay "$dev2"
not ls "$RUNDIR/lvm/pvs_online/$PVIDMD" not ls "$RUNDIR/lvm/pvs_online/$PVIDMD"
not ls "$RUNDIR/lvm/vgs_online/$vg" not ls "$RUNDIR/lvm/vgs_online/$vg"
aux cleanup_md_dev wipefs -a "$dev1"
wipefs -a "$dev2"
aux udev_wait
########################################## ##########################################
# PV on an md raid1 device, start+stopped # PV on an md raid1 device, start+stopped
@ -285,12 +293,9 @@ aux cleanup_md_dev
aux lvmconf 'devices/md_component_checks = "start"' aux lvmconf 'devices/md_component_checks = "start"'
wipefs -a "$dev1" "$dev2" mddev="/dev/md0"
aux prepare_md_dev 1 64 2 "$dev1" "$dev2" mdadm --create --metadata=1.0 "$mddev" --level 1 --chunk=64 --raid-devices=2 "$dev1" "$dev2"
sleep 4 aux wait_md_create "$mddev"
cat /proc/mdstat
mddev=$(< MD_DEV)
pvdev=$(< MD_DEV_PV)
pvcreate "$mddev" pvcreate "$mddev"
PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'` PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'`
echo $PVIDMD echo $PVIDMD
@ -367,12 +372,9 @@ wipefs -a "$dev2" || true
aux lvmconf 'devices/md_component_checks = "start"' aux lvmconf 'devices/md_component_checks = "start"'
wipefs -a "$dev1" "$dev2" mddev="/dev/md0"
aux prepare_md_dev 1 64 2 "$dev1" "$dev2" mdadm --create --metadata=1.0 "$mddev" --level 1 --chunk=64 --raid-devices=2 "$dev1" "$dev2"
sleep 4 aux wait_md_create "$mddev"
cat /proc/mdstat
mddev=$(< MD_DEV)
pvdev=$(< MD_DEV_PV)
pvcreate "$mddev" pvcreate "$mddev"
PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'` PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'`
echo $PVIDMD echo $PVIDMD
@ -442,11 +444,9 @@ wipefs -a "$dev2" || true
aux lvmconf 'devices/md_component_checks = "auto"' aux lvmconf 'devices/md_component_checks = "auto"'
aux prepare_md_dev 1 64 2 "$dev1" "$dev2" mddev="/dev/md0"
sleep 4 mdadm --create --metadata=1.0 "$mddev" --level 1 --chunk=64 --raid-devices=2 "$dev1" "$dev2"
cat /proc/mdstat aux wait_md_create "$mddev"
mddev=$(< MD_DEV)
pvdev=$(< MD_DEV_PV)
pvcreate "$mddev" pvcreate "$mddev"
PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'` PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'`
echo $PVIDMD echo $PVIDMD
@ -511,11 +511,9 @@ wipefs -a "$dev2" || true
aux lvmconf 'devices/md_component_checks = "auto"' aux lvmconf 'devices/md_component_checks = "auto"'
aux prepare_md_dev 1 64 3 "$dev1" "$dev2" "$dev4" mddev="/dev/md0"
sleep 4 mdadm --create --metadata=1.0 "$mddev" --level 1 --chunk=64 --raid-devices=3 "$dev1" "$dev2" "$dev4"
cat /proc/mdstat aux wait_md_create "$mddev"
mddev=$(< MD_DEV)
pvdev=$(< MD_DEV_PV)
pvcreate "$mddev" pvcreate "$mddev"
PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'` PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'`
echo $PVIDMD echo $PVIDMD
@ -563,7 +561,11 @@ pvscan --cache -aay "$dev4"
not ls "$RUNDIR/lvm/pvs_online/$PVIDMD" not ls "$RUNDIR/lvm/pvs_online/$PVIDMD"
not ls "$RUNDIR/lvm/vgs_online/$vg" not ls "$RUNDIR/lvm/vgs_online/$vg"
aux cleanup_md_dev wipefs -a "$dev1"
wipefs -a "$dev2"
wipefs -a "$dev4"
aux udev_wait
########################################## ##########################################
@ -574,12 +576,9 @@ aux cleanup_md_dev
aux lvmconf 'devices/md_component_checks = "start"' aux lvmconf 'devices/md_component_checks = "start"'
wipefs -a "$dev1" "$dev2" "$dev4" mddev="/dev/md0"
aux prepare_md_dev 1 64 3 "$dev1" "$dev2" "$dev4" mdadm --create --metadata=1.0 "$mddev" --level 1 --chunk=64 --raid-devices=3 "$dev1" "$dev2" "$dev4"
sleep 4 aux wait_md_create "$mddev"
cat /proc/mdstat
mddev=$(< MD_DEV)
pvdev=$(< MD_DEV_PV)
pvcreate "$mddev" pvcreate "$mddev"
PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'` PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'`
echo $PVIDMD echo $PVIDMD

View File

@ -11,6 +11,7 @@
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
SKIP_WITH_LVMPOLLD=1 SKIP_WITH_LVMPOLLD=1
SKIP_WITH_LVMLOCKD=1
RUNDIR="/run" RUNDIR="/run"
test -d "$RUNDIR" || RUNDIR="/var/run" test -d "$RUNDIR" || RUNDIR="/var/run"
@ -29,6 +30,7 @@ _clear_online_files() {
test -f /proc/mdstat && grep -q raid1 /proc/mdstat || \ test -f /proc/mdstat && grep -q raid1 /proc/mdstat || \
modprobe raid1 || skip modprobe raid1 || skip
not grep md0 /proc/mdstat
aux lvmconf 'devices/md_component_detection = 1' aux lvmconf 'devices/md_component_detection = 1'
@ -41,19 +43,16 @@ aux lvmconf 'devices/hints = "none"'
# want to rely on that ability in this test. # want to rely on that ability in this test.
aux lvmconf 'devices/obtain_device_list_from_udev = 0' aux lvmconf 'devices/obtain_device_list_from_udev = 0'
aux extend_filter_LVMTEST "a|/dev/md|" aux extend_filter_md "a|/dev/md|"
aux prepare_devs 3 aux prepare_devs 3
# 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"
cat /proc/mdstat
mddev=$(< MD_DEV)
pvdev=$(< MD_DEV_PV)
mddev="/dev/md0"
mdadm --create --metadata=1.0 "$mddev" --level 1 --chunk=64 --raid-devices=2 "$dev1" "$dev2"
aux wait_md_create "$mddev"
vgcreate $vg "$mddev" vgcreate $vg "$mddev"
PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'` PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'`
@ -164,19 +163,21 @@ aux udev_wait
vgremove -f $vg vgremove -f $vg
aux cleanup_md_dev mdadm --stop "$mddev"
aux udev_wait
wipefs -a "$dev1"
wipefs -a "$dev2"
aux udev_wait
# create 2 disk MD raid0 array # create 2 disk MD raid0 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
# When a raid0 md array is stopped, the components will not look like # When a raid0 md array is stopped, the components will not look like
# duplicate PVs as they do with raid1. # duplicate PVs as they do with raid1.
aux prepare_md_dev 0 64 2 "$dev1" "$dev2"
cat /proc/mdstat
mddev=$(< MD_DEV)
pvdev=$(< MD_DEV_PV)
mddev="/dev/md0"
mdadm --create --metadata=1.0 "$mddev" --level 0 --chunk=64 --raid-devices=2 "$dev1" "$dev2"
aux wait_md_create "$mddev"
vgcreate $vg "$mddev" vgcreate $vg "$mddev"
PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'` PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'`
@ -288,7 +289,12 @@ aux udev_wait
vgremove -f $vg vgremove -f $vg
aux cleanup_md_dev mdadm --stop "$mddev"
aux udev_wait
wipefs -a "$dev1"
wipefs -a "$dev2"
aux udev_wait
# Repeat tests using the default config settings # Repeat tests using the default config settings
@ -299,12 +305,10 @@ aux lvmconf 'devices/obtain_device_list_from_udev = 1'
# 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
# When a raid0 md array is stopped, the components will not look like # When a raid0 md array is stopped, the components will not look like
# duplicate PVs as they do with raid1. # duplicate PVs as they do with raid1.
aux prepare_md_dev 0 64 2 "$dev1" "$dev2"
cat /proc/mdstat mddev="/dev/md0"
mdadm --create --metadata=1.0 "$mddev" --level 0 --chunk=64 --raid-devices=2 "$dev1" "$dev2"
mddev=$(< MD_DEV) aux wait_md_create "$mddev"
pvdev=$(< MD_DEV_PV)
# Create an unused PV so that there is at least one PV in the hints # Create an unused PV so that there is at least one PV in the hints
# when the MD dev is stopped. If there are no PVs, the hints are # when the MD dev is stopped. If there are no PVs, the hints are
@ -454,5 +458,9 @@ aux udev_wait
vgremove -f $vg vgremove -f $vg
aux cleanup_md_dev mdadm --stop "$mddev"
aux udev_wait
wipefs -a "$dev1"
wipefs -a "$dev2"
aux udev_wait

View File

@ -20,17 +20,19 @@ which sfdisk || skip
test -f /proc/mdstat && grep -q raid0 /proc/mdstat || \ test -f /proc/mdstat && grep -q raid0 /proc/mdstat || \
modprobe raid0 || skip modprobe raid0 || skip
not grep md0 /proc/mdstat
aux lvmconf 'devices/md_component_detection = 1' aux lvmconf 'devices/md_component_detection = 1'
aux extend_filter_LVMTEST "a|/dev/md|" aux extend_filter_md "a|/dev/md|"
aux prepare_devs 2 aux prepare_devs 2
# create 2 disk MD raid0 array (stripe_width=128K) # create 2 disk MD raid0 array (stripe_width=128K)
aux prepare_md_dev 0 64 2 "$dev1" "$dev2" mddev="/dev/md0"
mdadm --create --metadata=1.0 "$mddev" --level 0 --chunk=64 --raid-devices=2 "$dev1" "$dev2"
aux wait_md_create "$mddev"
mddev=$(< MD_DEV) pvdev="$mddev"
pvdev=$(< MD_DEV_PV)
# Test alignment of PV on MD without any MD-aware or topology-aware detection # Test alignment of PV on MD without any MD-aware or topology-aware detection
# - should treat $mddev just like any other block device # - should treat $mddev just like any other block device
@ -82,7 +84,7 @@ EOF
if aux kernel_at_least 2 6 33 ; then if aux kernel_at_least 2 6 33 ; then
# in case the system is running without devtmpfs /dev # in case the system is running without devtmpfs /dev
# wait here for created device node on tmpfs # wait here for created device node on tmpfs
test "$DM_DEV_DIR" = "/dev" || cp -LR "${mddev}p1" "${pvdev%/*}" # test "$DM_DEV_DIR" = "/dev" || cp -LR "${mddev}p1" "${pvdev%/*}"
pvcreate --metadatasize 128k "${pvdev}p1" pvcreate --metadatasize 128k "${pvdev}p1"
@ -105,17 +107,23 @@ EOF
check pv_field "${pvdev}p1" pe_start $pv_align --units b --nosuffix check pv_field "${pvdev}p1" pe_start $pv_align --units b --nosuffix
pvremove "${pvdev}p1" pvremove "${pvdev}p1"
test "$DM_DEV_DIR" = "/dev" || rm -f "${pvdev}p1" # test "$DM_DEV_DIR" = "/dev" || rm -f "${pvdev}p1"
fi fi
fi fi
mdadm --stop "$mddev"
aux udev_wait
wipefs -a "$dev1"
wipefs -a "$dev2"
aux udev_wait
# Test newer topology-aware alignment detection w/ --dataalignment override # Test newer topology-aware alignment detection w/ --dataalignment override
if aux kernel_at_least 2 6 33 ; then if aux kernel_at_least 2 6 33 ; then
# make sure we're clean for another test
dd if=/dev/zero of="$mddev" bs=512 count=4 conv=fdatasync mddev="/dev/md0"
partprobe -s "$mddev" mdadm --create --metadata=1.0 "$mddev" --level 0 --chunk=1024 --raid-devices=2 "$dev1" "$dev2"
aux prepare_md_dev 0 1024 2 "$dev1" "$dev2" aux wait_md_create "$mddev"
pvdev=$(< MD_DEV_PV) pvdev="$mddev"
# optimal_io_size=2097152, minimum_io_size=1048576 # optimal_io_size=2097152, minimum_io_size=1048576
pvcreate --metadatasize 128k \ pvcreate --metadatasize 128k \
@ -130,4 +138,11 @@ if aux kernel_at_least 2 6 33 ; then
pvcreate --dataalignment 64k --metadatasize 128k \ pvcreate --dataalignment 64k --metadatasize 128k \
--config 'devices { md_chunk_alignment=0 }' "$pvdev" --config 'devices { md_chunk_alignment=0 }' "$pvdev"
check pv_field "$pvdev" pe_start "192.00k" check pv_field "$pvdev" pe_start "192.00k"
mdadm --stop "$mddev"
aux udev_wait
wipefs -a "$dev1"
wipefs -a "$dev2"
aux udev_wait
fi fi