mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-11 20:58:50 +03:00
tests: aux updates
Select unused md from /proc/mdstat Check for wipefs once.
This commit is contained in:
parent
370749a4b8
commit
b19e036918
@ -722,7 +722,7 @@ mdadm_create() {
|
|||||||
# using the old naming /dev/mdXXX
|
# using the old naming /dev/mdXXX
|
||||||
# if we need more MD arrays test suite more likely leaked them
|
# if we need more MD arrays test suite more likely leaked them
|
||||||
for devid in {127..150} ; do
|
for devid in {127..150} ; do
|
||||||
test -b /dev/md${devid} || break
|
grep -q "md${devid}" /proc/mdstat || break
|
||||||
done
|
done
|
||||||
test "$devid" -lt "150" || skip "Cannot find free /dev/mdXXX node!"
|
test "$devid" -lt "150" || skip "Cannot find free /dev/mdXXX node!"
|
||||||
mddev=/dev/md${devid}
|
mddev=/dev/md${devid}
|
||||||
@ -793,10 +793,10 @@ cleanup_md_dev() {
|
|||||||
udev_wait # wait till events are process, not zeroing to early
|
udev_wait # wait till events are process, not zeroing to early
|
||||||
done
|
done
|
||||||
|
|
||||||
test "$DM_DEV_DIR" != "/dev" && rm -f "$(< MD_DEV_PV)"
|
test "$DM_DEV_DIR" = "/dev" || rm -f "$(< MD_DEV_PV)"
|
||||||
|
|
||||||
for dev in $(< MD_DEVICES); do
|
for dev in $(< MD_DEVICES); do
|
||||||
mdadm --zero-superblock "$dev" || true
|
mdadm --zero-superblock "$dev" 2>/dev/null
|
||||||
done
|
done
|
||||||
udev_wait
|
udev_wait
|
||||||
rm -f MD_DEV MD_DEVICES MD_DEV_PV
|
rm -f MD_DEV MD_DEVICES MD_DEV_PV
|
||||||
@ -804,17 +804,25 @@ cleanup_md_dev() {
|
|||||||
|
|
||||||
wipefs_a() {
|
wipefs_a() {
|
||||||
local dev=$1
|
local dev=$1
|
||||||
|
local have_wipefs=1
|
||||||
shift
|
shift
|
||||||
|
|
||||||
if test -n "$LVM_TEST_DEVICES_FILE"; then
|
if test -n "$LVM_TEST_DEVICES_FILE"; then
|
||||||
lvmdevices --deldev $dev || true
|
lvmdevices --deldev $dev || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if wipefs -V >/dev/null; then
|
if test -f HAVE_WIPEFS ; then
|
||||||
|
have_wipefs=$(< HAVE_WIPEFS)
|
||||||
|
else
|
||||||
|
wipefs -V >/dev/null 2>&1 || have_wipefs=0
|
||||||
|
echo "$have_wipefs" > HAVE_WIPEFS
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$have_wipefs" = "1" ] ; then
|
||||||
wipefs -a "$dev"
|
wipefs -a "$dev"
|
||||||
else
|
else
|
||||||
dd if=/dev/zero of="$dev" bs=4096 count=8 || true
|
dd if=/dev/zero of="$dev" bs=4096 count=8 >/dev/null || true
|
||||||
mdadm --zero-superblock "$dev" || true
|
mdadm --zero-superblock "$dev" 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -n "$LVM_TEST_DEVICES_FILE"; then
|
if test -n "$LVM_TEST_DEVICES_FILE"; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user