mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-27 11:29:36 +03:00
ZTS: Eliminate partitioning from zpool_destroy
The zpool destroy tests partition a single disk to create two pools. This can be done using two disks and no partitioning instead. And temporarily allow vol recursion for FreeBSD while in here. Reviewed-by: John Kennedy <john.kennedy@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #10036
This commit is contained in:
parent
b7dbbf6aa7
commit
24fcd9fc5c
@ -28,18 +28,10 @@
|
|||||||
# Copyright (c) 2012 by Delphix. All rights reserved.
|
# Copyright (c) 2012 by Delphix. All rights reserved.
|
||||||
#
|
#
|
||||||
|
|
||||||
export DISK=${DISKS%% *}
|
|
||||||
export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}')
|
export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}')
|
||||||
export DISKSARRAY=$DISKS
|
export DISKSARRAY=$DISKS
|
||||||
|
echo $DISKS | read DISK0 DISK1
|
||||||
|
|
||||||
if is_linux; then
|
if is_linux; then
|
||||||
set_device_dir
|
set_device_dir
|
||||||
set_slice_prefix
|
|
||||||
export SLICE0=1
|
|
||||||
export SLICE1=2
|
|
||||||
else
|
|
||||||
export SLICE0=0
|
|
||||||
export SLICE1=1
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
export SLICE_SIZE=500m
|
|
||||||
|
@ -56,26 +56,24 @@ function cleanup
|
|||||||
poolexists $pool && destroy_pool $pool
|
poolexists $pool && destroy_pool $pool
|
||||||
done
|
done
|
||||||
|
|
||||||
zero_partitions $DISK
|
[ -n "$recursive" ] && set_tunable64 VOL_RECURSIVE $recursive
|
||||||
}
|
}
|
||||||
|
|
||||||
set -A datasets "$TESTPOOL" "$TESTPOOL2"
|
set -A datasets "$TESTPOOL" "$TESTPOOL2"
|
||||||
|
|
||||||
if ! is_physical_device $DISKS; then
|
|
||||||
log_unsupported "This case cannot be run on raw files."
|
|
||||||
fi
|
|
||||||
|
|
||||||
log_assert "'zpool destroy <pool>' can destroy a specified pool."
|
log_assert "'zpool destroy <pool>' can destroy a specified pool."
|
||||||
|
|
||||||
log_onexit cleanup
|
log_onexit cleanup
|
||||||
|
|
||||||
partition_disk $SLICE_SIZE $DISK 2
|
create_pool $TESTPOOL $DISK0
|
||||||
|
create_pool $TESTPOOL1 $DISK1
|
||||||
create_pool "$TESTPOOL" "${DISK}${SLICE_PREFIX}${SLICE0}"
|
|
||||||
create_pool "$TESTPOOL1" "${DISK}${SLICE_PREFIX}${SLICE1}"
|
|
||||||
log_must zfs create -s -V $VOLSIZE $TESTPOOL1/$TESTVOL
|
log_must zfs create -s -V $VOLSIZE $TESTPOOL1/$TESTVOL
|
||||||
block_device_wait
|
block_device_wait
|
||||||
create_pool "$TESTPOOL2" "${ZVOL_DEVDIR}/$TESTPOOL1/$TESTVOL"
|
if is_freebsd; then
|
||||||
|
typeset recursive=$(get_tunable VOL_RECURSIVE)
|
||||||
|
log_must set_tunable64 VOL_RECURSIVE 1
|
||||||
|
fi
|
||||||
|
create_pool $TESTPOOL2 $ZVOL_DEVDIR/$TESTPOOL1/$TESTVOL
|
||||||
|
|
||||||
typeset -i i=0
|
typeset -i i=0
|
||||||
while (( i < ${#datasets[*]} )); do
|
while (( i < ${#datasets[*]} )); do
|
||||||
|
@ -73,9 +73,7 @@ log_assert "'zpool destroy -f <pool>' can forcely destroy the specified pool"
|
|||||||
|
|
||||||
log_onexit cleanup
|
log_onexit cleanup
|
||||||
|
|
||||||
typeset cwd=""
|
create_pool $TESTPOOL $DISK0
|
||||||
|
|
||||||
create_pool "$TESTPOOL" "$DISK"
|
|
||||||
log_must zfs create $TESTPOOL/$TESTFS
|
log_must zfs create $TESTPOOL/$TESTFS
|
||||||
log_must mkdir -p $TESTDIR
|
log_must mkdir -p $TESTDIR
|
||||||
log_must zfs set mountpoint=$TESTDIR $TESTPOOL/$TESTFS
|
log_must zfs set mountpoint=$TESTDIR $TESTPOOL/$TESTFS
|
||||||
@ -90,7 +88,6 @@ while (( $i < ${#datasets[*]} )); do
|
|||||||
((i = i + 1))
|
((i = i + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
cwd=$PWD
|
|
||||||
log_note "'zpool destroy' without '-f' will fail " \
|
log_note "'zpool destroy' without '-f' will fail " \
|
||||||
"while pool is busy."
|
"while pool is busy."
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user