]> git.proxmox.com Git - mirror_zfs.git/commitdiff
ZTS: Eliminate partitioning from zpool_destroy
authorRyan Moeller <ryan@iXsystems.com>
Sat, 22 Feb 2020 00:00:23 +0000 (19:00 -0500)
committerGitHub <noreply@github.com>
Sat, 22 Feb 2020 00:00:22 +0000 (16:00 -0800)
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

tests/zfs-tests/tests/functional/cli_root/zpool_destroy/zpool_destroy.cfg
tests/zfs-tests/tests/functional/cli_root/zpool_destroy/zpool_destroy_001_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_destroy/zpool_destroy_002_pos.ksh

index 9349e5ff63923a41299e1d1fc246748573f528ce..bf6026747f9a0ae8110a6d875d47d5e59ec80eaf 100644 (file)
 # Copyright (c) 2012 by Delphix. All rights reserved.
 #
 
-export DISK=${DISKS%% *}
 export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}')
 export DISKSARRAY=$DISKS
+echo $DISKS | read DISK0 DISK1
 
 if is_linux; then
        set_device_dir
-       set_slice_prefix
-       export SLICE0=1
-       export SLICE1=2
-else
-       export SLICE0=0
-       export SLICE1=1
-
 fi
-export SLICE_SIZE=500m
index 041a1d00cb84205ecd3d9b31fb01fec24c921406..3323f1db0cafe1f611abdc677ac096ccc1703d66 100755 (executable)
@@ -56,26 +56,24 @@ function cleanup
                poolexists $pool && destroy_pool $pool
        done
 
-       zero_partitions $DISK
+       [ -n "$recursive" ] && set_tunable64 VOL_RECURSIVE $recursive
 }
 
 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_onexit cleanup
 
-partition_disk $SLICE_SIZE $DISK 2
-
-create_pool "$TESTPOOL" "${DISK}${SLICE_PREFIX}${SLICE0}"
-create_pool "$TESTPOOL1" "${DISK}${SLICE_PREFIX}${SLICE1}"
+create_pool $TESTPOOL $DISK0
+create_pool $TESTPOOL1 $DISK1
 log_must zfs create -s -V $VOLSIZE $TESTPOOL1/$TESTVOL
 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
 while (( i < ${#datasets[*]} )); do
index ad9425795c20c54442a186c553049850e1e3570b..794a6c37c37a45fd45af68b21cf6c21261936f9f 100755 (executable)
@@ -73,9 +73,7 @@ log_assert "'zpool destroy -f <pool>' can forcely destroy the specified pool"
 
 log_onexit cleanup
 
-typeset cwd=""
-
-create_pool "$TESTPOOL" "$DISK"
+create_pool $TESTPOOL $DISK0
 log_must zfs create $TESTPOOL/$TESTFS
 log_must mkdir -p $TESTDIR
 log_must zfs set mountpoint=$TESTDIR $TESTPOOL/$TESTFS
@@ -90,7 +88,6 @@ while (( $i < ${#datasets[*]} )); do
        ((i = i + 1))
 done
 
-cwd=$PWD
 log_note "'zpool destroy' without '-f' will fail " \
        "while pool is busy."