From 3bdc4f6314ab55d1ee78ec8a2a6b77e5a3282ca3 Mon Sep 17 00:00:00 2001 From: Ryan Moeller Date: Thu, 13 Feb 2020 15:10:36 -0500 Subject: [PATCH] ZTS: Eliminate partitioning from zpool_remove These tests do not need to use partitions. Get rid of the partitioning and just use the disks directly. Reviewed-by: John Kennedy Reviewed-by: Brian Behlendorf Signed-off-by: Ryan Moeller Closes #9996 --- .../cli_root/zpool_remove/setup.ksh | 6 ----- .../cli_root/zpool_remove/zpool_remove.cfg | 27 +------------------ .../zpool_remove/zpool_remove_001_neg.ksh | 11 ++++---- .../zpool_remove/zpool_remove_002_pos.ksh | 5 ++-- .../zpool_remove/zpool_remove_003_pos.ksh | 10 +++---- 5 files changed, 12 insertions(+), 47 deletions(-) diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_remove/setup.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_remove/setup.ksh index c63e179459..8ce094bcc7 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_remove/setup.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_remove/setup.ksh @@ -34,10 +34,4 @@ verify_runnable "global" -if ! is_physical_device $DISKS ; then - log_unsupported "This directory cannot be run on raw files." -fi - -partition_disk $SIZE $DISK 6 - log_pass diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_remove/zpool_remove.cfg b/tests/zfs-tests/tests/functional/cli_root/zpool_remove/zpool_remove.cfg index bf4b3e3d0b..1b8312e993 100644 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_remove/zpool_remove.cfg +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_remove/zpool_remove.cfg @@ -28,29 +28,4 @@ # Copyright (c) 2012 by Delphix. All rights reserved. # -export DISK=${DISKS%% *} -export SIZE="200m" -export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}') -export DISKSARRAY=$DISKS - -if is_linux; then - set_device_dir - set_slice_prefix - export SLICE0=1 - export SLICE1=2 - export SLICE2=3 - export SLICE3=4 - export SLICE4=5 - export SLICE5=6 - export SLICE6=7 - export SLICE7=8 -else - export SLICE0=0 - export SLICE1=1 - export SLICE2=2 - export SLICE3=3 - export SLICE4=4 - export SLICE5=5 - export SLICE6=6 - export SLICE7=7 -fi +echo $DISKS | read DISK0 DISK1 DISK2 diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_remove/zpool_remove_001_neg.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_remove/zpool_remove_001_neg.ksh index 365e86cfa8..0c098a61e2 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_remove/zpool_remove_001_neg.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_remove/zpool_remove_001_neg.ksh @@ -42,14 +42,13 @@ # 3. Verify that the remove failed. # -typeset disk=${DISK} -typeset vdev_devs="${disk}${SLICE_PREFIX}${SLICE0}" -typeset mirror_devs="${disk}${SLICE_PREFIX}${SLICE0} ${disk}${SLICE_PREFIX}${SLICE1}" +typeset vdev_devs="${DISK0}" +typeset mirror_devs="${DISK0} ${DISK1}" typeset raidz_devs=${mirror_devs} typeset raidz1_devs=${mirror_devs} -typeset raidz2_devs="${mirror_devs} ${disk}${SLICE_PREFIX}${SLICE3}" -typeset spare_devs1="${disk}${SLICE_PREFIX}${SLICE0}" -typeset spare_devs2="${disk}${SLICE_PREFIX}${SLICE1}" +typeset raidz2_devs="${mirror_devs} ${DISK2}" +typeset spare_devs1="${DISK0}" +typeset spare_devs2="${DISK1}" function check_remove { diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_remove/zpool_remove_002_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_remove/zpool_remove_002_pos.ksh index 340735aa00..4ab7ac659b 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_remove/zpool_remove_002_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_remove/zpool_remove_002_pos.ksh @@ -50,10 +50,9 @@ function cleanup } log_onexit cleanup -typeset disk=${DISK} -typeset spare_devs1="${disk}${SLICE_PREFIX}${SLICE0}" -typeset spare_devs2="${disk}${SLICE_PREFIX}${SLICE1}" +typeset spare_devs1="${DISK0}" +typeset spare_devs2="${DISK1}" log_assert "zpool remove can only remove inactive hotspare device from pool" diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_remove/zpool_remove_003_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_remove/zpool_remove_003_pos.ksh index c27c4c7d8f..4e132d9d00 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_remove/zpool_remove_003_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_remove/zpool_remove_003_pos.ksh @@ -54,17 +54,15 @@ function cleanup log_onexit cleanup typeset disk=${DISK} -typeset spare_devs1="${disk}${SLICE_PREFIX}${SLICE0}" -typeset spare_devs2="${disk}${SLICE_PREFIX}${SLICE1}" -typeset spare_devs3="${disk}${SLICE_PREFIX}${SLICE3}" -typeset spare_devs4="${disk}${SLICE_PREFIX}${SLICE4}" +typeset spare_devs1="${DISK0}" +typeset spare_devs2="${DISK1}" +typeset spare_devs3="${DISK2}" log_assert "zpool remove can remove hotspare device which state go though" \ " active to inactive in pool" log_note "Check spare device which state go through active to inactive" -log_must zpool create $TESTPOOL $spare_devs1 $spare_devs2 spare \ - $spare_devs3 $spare_devs4 +log_must zpool create $TESTPOOL $spare_devs1 $spare_devs2 spare $spare_devs3 log_must zpool replace $TESTPOOL $spare_devs2 $spare_devs3 log_mustnot zpool remove $TESTPOOL $spare_devs3 log_must zpool detach $TESTPOOL $spare_devs3