svn commit: r328572 - in projects/zfsd/head/tests/sys/cddl/zfs: include tests/hotplug

Alan Somers asomers at FreeBSD.org
Mon Jan 29 23:53:54 UTC 2018


Author: asomers
Date: Mon Jan 29 23:53:53 2018
New Revision: 328572
URL: https://svnweb.freebsd.org/changeset/base/328572

Log:
  Enable some of the ZFS test suite's hotplug tests.
  
  The hotplug subdirectory has never previously been ported to FreeBSD,
  because its tests relied on the Solaris-specific lofiadm(8) command.  I
  ported three of them, taking advantage of gnop(8) to simulate device
  departure and arrival.  I left the other 8 disabled because they're
  redundant, Solaris-specific, or useless.
  
  tests/sys/cddl/zfs/include/Makefile
  tests/sys/cddl/zfs/include/libgnop.kshlib
  	Add a library for manipulating gnop devices.  In the future, I
  	intend to adapt the zfsd tests to use this library rather than
  	libsas.kshlib.
  
  tests/sys/cddl/zfs/tests/hotplug/cleanup.ksh
  tests/sys/cddl/zfs/tests/hotplug/hotplug.cfg
  tests/sys/cddl/zfs/tests/hotplug/hotplug.kshlib
  tests/sys/cddl/zfs/tests/hotplug/hotplug_001_pos.ksh
  tests/sys/cddl/zfs/tests/hotplug/hotplug_008_pos.ksh
  tests/sys/cddl/zfs/tests/hotplug/hotplug_011_pos.ksh
  tests/sys/cddl/zfs/tests/hotplug/setup.ksh
  	Port all this stuff to FreeBSD:
  	* Remove all references to FMA
  	* Instead of lofiadm(8) (roughly equivalent to vnode-backed md(4)
  	  devices), use gnop(8) on top of real disks.
  	* Remove references to zones
  	* Don't bother doing background I/O.  It's completely superfluous
  	  to the purpose of these tests.
  	* Use ATF cleanup routines instead of the log_onexitmethod.
  	* Remove superfluous references to the autoreplace property.
  
  tests/sys/cddl/zfs/tests/hotplug/hotplug_011_pos.ksh
  	Instead of unloading the ZFS module to simulate a reboot, simply
  	export the pool.  It's the same thing from ZFS's perspective.
  
  tests/sys/cddl/zfs/tests/hotplug/hotplug_test.sh
  	Enable the three aforementioned tests.  Add comments to the others
  	indicating why I'm skipping them.  Reduce extra-long timeouts to the
  	default 5 minutes.
  
  Sponsored by:	Spectra Logic Corp

Added:
  projects/zfsd/head/tests/sys/cddl/zfs/include/libgnop.kshlib
Modified:
  projects/zfsd/head/tests/sys/cddl/zfs/include/Makefile
  projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/cleanup.ksh
  projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug.cfg
  projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug.kshlib
  projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_001_pos.ksh
  projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_008_pos.ksh
  projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_011_pos.ksh
  projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_test.sh
  projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/setup.ksh

Modified: projects/zfsd/head/tests/sys/cddl/zfs/include/Makefile
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/include/Makefile	Mon Jan 29 23:43:04 2018	(r328571)
+++ projects/zfsd/head/tests/sys/cddl/zfs/include/Makefile	Mon Jan 29 23:53:53 2018	(r328572)
@@ -13,6 +13,7 @@ FILESDIR=	${TESTSBASE}/sys/cddl/zfs/include
 ${PACKAGE}FILES+=		constants.cfg
 ${PACKAGE}FILES+=		libremote.kshlib
 ${PACKAGE}FILES+=		libsas.kshlib
+${PACKAGE}FILES+=		libgnop.kshlib
 ${PACKAGE}FILES+=		logapi.kshlib
 ${PACKAGE}FILES+=		libtest.kshlib
 ${PACKAGE}FILES+=		stf.shlib

Added: projects/zfsd/head/tests/sys/cddl/zfs/include/libgnop.kshlib
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/zfsd/head/tests/sys/cddl/zfs/include/libgnop.kshlib	Mon Jan 29 23:53:53 2018	(r328572)
@@ -0,0 +1,89 @@
+#
+# Copyright (c) 2017 Spectra Logic Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions, and the following disclaimer,
+#    without modification.
+# 2. Redistributions in binary form must reproduce at minimum a disclaimer
+#    substantially similar to the "NO WARRANTY" disclaimer below
+#    ("Disclaimer") and any redistribution must be conditioned upon
+#    including a substantially similar Disclaimer requirement for further
+#    binary redistribution.
+#
+# NO WARRANTY
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGES.
+#
+# $FreeBSD$
+#
+
+#
+# Routines that use gnop(8) to simulate devices that can disappear at any time
+#
+
+# Create a gnop device on top of a real device.  Don't use the full extent; use
+# a portion in the middle so that any ZFS label present on the real device
+# won't be present on the gnop device and vice versa.
+function create_gnop
+{
+	typeset disk=$1
+	# size of disk in bytes
+	typeset -li disk_size
+	# disk size, rounded down to multiple of 16384
+	typeset -li disk_size_rounded
+	# size of the nop device in bytes
+	typeset -li nop_size
+	# offset of the beginning of the nop device in bytes
+	typeset -li nop_offset
+
+	disk_size=`diskinfo da0 | cut -f 3`
+	# Round it down so the nop device will be 4k-aligned
+	disk_size_rounded=$(( ${disk_size} / 16384 * 16384 ))
+	nop_size=$(( ${disk_size_rounded} / 4 ))
+	nop_offset=${nop_size}
+
+	gnop create -s ${nop_size} -o ${nop_offset} ${disk}
+}
+
+# Create multiple gnop devices
+function create_gnops
+{
+	typeset disk
+	for disk in $@; do
+		create_gnop "$disk" || return 1
+	done
+	return 0
+}
+
+# Destroy a gnop device.  
+function destroy_gnop
+{
+	# Name of the underlying (non-gnop) device
+	typeset disk=$1
+
+	# Use "-f" so we can destroy a gnop with a consumer (like ZFS)
+	gnop destroy -f ${disk}.nop
+}
+
+# Destroy multiple gnop devices.  Attempt to destroy them all, ignoring errors
+function destroy_gnops
+{
+	typeset disk
+	for disk in $@; do
+		destroy_gnop "$disk"
+	done
+	return 0
+}

Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/cleanup.ksh
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/cleanup.ksh	Mon Jan 29 23:43:04 2018	(r328571)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/cleanup.ksh	Mon Jan 29 23:53:53 2018	(r328572)
@@ -29,22 +29,5 @@
 
 . $STF_SUITE/tests/hotplug/hotplug.kshlib
 
-if ! $LOFIADM -f > /dev/null 2>&1; then
-	log_unsupported
-fi
-
-verify_runnable "global"
-
 cleanup_testenv $TESTPOOL
-log_must destroy_lofi_device $ALL_FILES
-
-#
-# record repair to resource(s) to cleanup fma faulty
-#
-log_must repair_faulty
-
-if [[ -d $VDEV_DIR ]]; then
-	log_must $RM -rf $VDEV_DIR
-fi
-
-log_pass
+destroy_gnops $ALL_DISKS

Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug.cfg
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug.cfg	Mon Jan 29 23:43:04 2018	(r328571)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug.cfg	Mon Jan 29 23:53:53 2018	(r328572)
@@ -26,16 +26,8 @@
 # ident	"@(#)hotplug.cfg	1.3	08/08/15 SMI"
 #
 
-export STF_TIMEOUT=1800
+export DEV_DISKS="$DISK0 $DISK1 $DISK2"
+export SPARE_DISKS="$DISK3"
+export ALL_DISKS="$DEV_DISKS $SPARE_DISKS"
 
-export BG_PID=''
-
-export VDEV_DIR=/disk.${TESTCASE_ID}
-export FILE_EVENT_ID=$VDEV_DIR/fma-event-id
-
-export NEWFILE=$VDEV_DIR/e
-export SMALLFILE=$VDEV_DIR/smalldisk
-
-export DEV_FILES="$VDEV_DIR/a $VDEV_DIR/b $VDEV_DIR/c"
-export SPARE_FILES="$VDEV_DIR/d"
-export ALL_FILES="$DEV_FILES $SPARE_FILES $NEWFILE $SMALLFILE"
+set_disks

Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug.kshlib
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug.kshlib	Mon Jan 29 23:43:04 2018	(r328571)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug.kshlib	Mon Jan 29 23:53:53 2018	(r328572)
@@ -27,6 +27,8 @@
 #
 
 . $STF_SUITE/include/libtest.kshlib
+. $STF_SUITE/include/libgnop.kshlib
+. $STF_SUITE/tests/hotplug/hotplug.cfg
 
 #
 # create lofi devices 
@@ -76,33 +78,20 @@ function destroy_lofi_device
 }
 
 #
-# Setup test environment using FILE[1-4]
+# Setup test environment using DISKS[1-4]
 #
-# $1 pool name
-# $2 pool type
+# $1 pool type
 #
 function setup_testenv
 {
-	typeset pool=$1
-	typeset type=$2
+	typeset type=$1
 
-	if [[ -z $pool || -z $type ]]; then
-		log_fail "Usage: setup_testenv <pool> <type>"
+	if [[ -z $type ]]; then
+		log_fail "Usage: setup_testenv <type>"
 	fi
 
-	log_must repair_faulty
-
-	log_must create_lofi_device $DEV_FILES $SPARE_FILES
-
-	typeset devlist=$(convert_lofi $DEV_FILES)
-	typeset sparelist=$(convert_lofi $SPARE_FILES)
-	typeset spare=$(random_get_with_non "spare")
 	log_must $ZPOOL create -f \
-		$pool $type $devlist $spare $sparelist
-	log_must start_bg_write $pool
-
-	# Provide 10 seconds for background process to write
-	$SLEEP 10
+		$TESTPOOL $type ${DISK0}.nop ${DISK1}.nop ${DISK2}.nop ${DISK3}.nop
 }
 
 #
@@ -112,35 +101,7 @@ function setup_testenv
 #
 function cleanup_testenv
 {
-	typeset pool=$1
-
-	if [[ -z $pool ]]; then
-		log_fail "Usage: cleanup_testenv <pool>"
-	fi
-
-	log_must repair_faulty
-
-	kill_bg_write
-	log_must $SYNC
-	$SLEEP 10
-
-	typeset -i i=0
-	if datasetexists $pool; then
-		typeset mntpnt=$(get_prop mountpoint $pool)
-		# Try three times in order to ensure successful pool destruction
-		while ((i < 3)); do
-			$ZPOOL destroy -f $pool
-			if (($? == 0)); then
-				break
-			fi
-			$SLEEP 5
-			((i += 1))
-		done
-	fi
-
-	if ((i == 3)); then
-		log_fail "Unable to destroy $pool, even after 3 attempts."
-	fi
+	destroy_pool $TESTPOOL
 }
 
 
@@ -350,22 +311,6 @@ function getfmri
 			start = 0
 		}
 		(start == 3) {print $4}' > $output_file
-}
-
-#
-# Repair all the fma error in current system
-#
-function repair_faulty
-{
-	getfmri $FILE_EVENT_ID
-	while read item; do
-		$FMADM repair $item > /dev/null 2>&1
-		if (($? != 0)); then
-			return 1
-		fi
-	done < $FILE_EVENT_ID
-
-	return 0
 }
 
 #

Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_001_pos.ksh
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_001_pos.ksh	Mon Jan 29 23:43:04 2018	(r328571)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_001_pos.ksh	Mon Jan 29 23:53:53 2018	(r328572)
@@ -37,7 +37,7 @@
 #
 # DESCRIPTION:
 #	When removing a device from a redundant pool, the device's state will
-#	be indicated as 'REMOVED'. No FMA faulty message.
+#	be indicated as 'REMOVED'.
 #
 # STRATEGY:
 #	1. Create mirror/raidz/raidz2 pool.
@@ -56,31 +56,19 @@
 #
 ################################################################################
 
-verify_runnable "global"
-
-function cleanup
-{
-	cleanup_testenv $TESTPOOL
-}
-
 log_assert "When removing a device from a redundant pool, the device's " \
-	"state will be indicated as 'REMOVED'. No FMA faulty message."
-log_onexit cleanup
+	"state will be indicated as 'REMOVED'."
 
 for type in "mirror" "raidz" "raidz2"; do
 	log_note "Start $type testing ..."
-	setup_testenv $TESTPOOL $type
+	setup_testenv $type
 
-	typeset file=$(random_get $DEV_FILES)
-	typeset device=$(convert_lofi $file)
-	log_must remove_device $device
-	log_must $ZPOOL clear $TESTPOOL
+	log_must destroy_gnop $DISK0
+	log_must check_state $TESTPOOL ${DISK0}.nop 'REMOVED' 
 
-	log_must verify_device_status $TESTPOOL $device 'REMOVED' 
-	log_must fma_faulty 'FALSE'
-
+	log_must create_gnop $DISK0
 	cleanup_testenv $TESTPOOL
 done
 
 log_pass "When removing a device from a redundant pool, the device's " \
-	"state will be indicated as 'REMOVED'. No FMA faulty message."
+	"state will be indicated as 'REMOVED'."

Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_008_pos.ksh
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_008_pos.ksh	Mon Jan 29 23:43:04 2018	(r328571)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_008_pos.ksh	Mon Jan 29 23:53:53 2018	(r328572)
@@ -56,33 +56,16 @@
 #
 ################################################################################
 
-log_unsupported "Hotplugging of hotspare devices is not supported."
-
-verify_runnable "global"
-
-function cleanup
-{
-	cleanup_testenv $TESTPOOL
-}
-
 log_assert "When removing hotspare device, verify device status is 'REMOVED'."
-log_onexit cleanup
 
 for type in "mirror" "raidz" "raidz2"; do
-	log_must create_lofi_device $DEV_FILES $SPARE_FILES
-	log_must $ZPOOL create -f $TESTPOOL $type $DEV_FILES spare $SPARE_FILES
-	log_must start_bg_write $TESTPOOL
-	typeset val=$(random_get "on" "off")
-	log_must $ZPOOL set autoreplace=$val $TESTPOOL
+	log_must $ZPOOL create -f $TESTPOOL $type $DISK0.nop $DISK1.nop $DISK2.nop spare $DISK3.nop
 
-	typeset file=$(random_get $SPARE_FILES)
-	typeset device=$(convert_lofi $file)
-	log_must remove_device $device
-	log_must $ZPOOL clear $TESTPOOL
+	log_must destroy_gnop $DISK3
+	wait_for 15 1 check_state $TESTPOOL $DISK3.nop 'REMOVED'
+	log_must check_state $TESTPOOL $DISK3.nop 'REMOVED'
 
-	log_must verify_device_status $TESTPOOL $device 'REMOVED'
-	log_must fma_faulty 'TRUE'
-
+	log_must create_gnop $DISK3
 	cleanup_testenv $TESTPOOL
 done
 

Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_011_pos.ksh
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_011_pos.ksh	Mon Jan 29 23:43:04 2018	(r328571)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_011_pos.ksh	Mon Jan 29 23:53:53 2018	(r328572)
@@ -58,62 +58,25 @@
 #
 ################################################################################
 
-verify_runnable "global"
+log_assert "If a vdev is missing when a pool is imported, its status will be " \
+	"UNAVAIL"
 
-fstype=$(get_fstype '/')
-if [[ $fstype == 'zfs' ]]; then
-	log_unsupported "This test cases is not supported on ZFS root system."
-fi
-
-function cleanup
-{
-	typeset fmri
-	for fmri in 'sysevent' 'fmd'; do
-		typeset stat=$($SVCS -H -o STATE $fmri)
-		if [[ $stat != 'online' ]]; then
-			log_must $SVCADM enable $fmri
-		fi
-		$SLEEP 5
-	done
-
-	cleanup_testenv $TESTPOOL
-}
-
-log_assert "Removing device offlined, verify device status is UNAVAIL, " \
-	"when the system is onlined."
-log_onexit cleanup
-
 for type in "mirror" "raidz" "raidz2"; do
-	setup_testenv $TESTPOOL $type
-	typeset val=$(random_get 'off' 'on')
-	log_must $ZPOOL set autoreplace=$val $TESTPOOL
+	setup_testenv $type
 
-	#
-	# Piror to unmount, stop background writing to avoid mount failed
-	# due to mountpoint is not empty
-	#
-	log_must kill_bg_write
+	log_must $ZPOOL export $TESTPOOL
 
-	#
-	# Unloading ZFS module to simulate system powered off
-	#
-	log_must unload_zfs
-
 	# Random remove one of devices
-	typeset file=$(random_get $DEV_FILES)
-	typeset device=$(convert_lofi $file)
-	log_must remove_device $device
+	log_must destroy_gnop $DISK0
 
-	# Reload ZFS module
-	log_must load_zfs
+	# reimport the pool
+	log_must $ZPOOL import $TESTPOOL
 
-	# After mount, restart background writing process
-	log_must start_bg_write $TESTPOOL
-	log_must verify_device_status $TESTPOOL $device 'UNAVAIL' 
-	log_must fma_faulty 'FALSE'
+	log_must check_state $TESTPOOL $DISK0.nop 'UNAVAIL' 
 
+	log_must create_gnop $DISK0
 	cleanup_testenv $TESTPOOL
 done
 
-log_pass "Removing device offlined, verify device status is UNAVAIL, " \
-	"when the system is onlined."
+log_pass "If a vdev is missing when a pool is imported, its status will be " \
+	"UNAVAIL"

Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_test.sh
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_test.sh	Mon Jan 29 23:43:04 2018	(r328571)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_test.sh	Mon Jan 29 23:53:53 2018	(r328572)
@@ -27,9 +27,8 @@
 atf_test_case hotplug_001_pos cleanup
 hotplug_001_pos_head()
 {
-	atf_set "descr" "When removing a device from a redundant pool, the device'sstate will be indicated as 'REMOVED'. No FMA faulty message."
-	atf_set "require.progs"  zpool lofiadm
-	atf_set "timeout" 1800
+	atf_set "descr" "When removing a device from a redundant pool, the device'sstate will be indicated as 'REMOVED'."
+	atf_set "require.progs"  zpool gnop
 }
 hotplug_001_pos_body()
 {
@@ -37,6 +36,7 @@ hotplug_001_pos_body()
 	. $(atf_get_srcdir)/hotplug.kshlib
 	. $(atf_get_srcdir)/hotplug.cfg
 
+	verify_disk_count "$DISKS" 4
 	ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
 	ksh93 $(atf_get_srcdir)/hotplug_001_pos.ksh || atf_fail "Testcase failed"
 }
@@ -53,9 +53,8 @@ hotplug_001_pos_cleanup()
 atf_test_case hotplug_002_pos cleanup
 hotplug_002_pos_head()
 {
-	atf_set "descr" "When removing and reinserting a device, the device status isONLINE with no FMA errors."
-	atf_set "require.progs"  zpool lofiadm
-	atf_set "timeout" 1800
+	atf_set "descr" "When removing and reinserting a device, the device status is ONLINE."
+	atf_set "require.progs"  zpool gnop
 }
 hotplug_002_pos_body()
 {
@@ -63,6 +62,8 @@ hotplug_002_pos_body()
 	. $(atf_get_srcdir)/hotplug.kshlib
 	. $(atf_get_srcdir)/hotplug.cfg
 
+	atf_skip "redundant with zfsd_replace_001_pos"
+	verify_disk_count "$DISKS" 4
 	ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
 	ksh93 $(atf_get_srcdir)/hotplug_002_pos.ksh || atf_fail "Testcase failed"
 }
@@ -89,6 +90,7 @@ hotplug_003_pos_body()
 	. $(atf_get_srcdir)/hotplug.kshlib
 	. $(atf_get_srcdir)/hotplug.cfg
 
+	atf_skip "redundant with zfsd_autoreplace_00[12]*"
 	ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
 	ksh93 $(atf_get_srcdir)/hotplug_003_pos.ksh || atf_fail "Testcase failed"
 }
@@ -115,6 +117,7 @@ hotplug_004_pos_body()
 	. $(atf_get_srcdir)/hotplug.kshlib
 	. $(atf_get_srcdir)/hotplug.cfg
 
+	atf_skip "Does not apply to FreeBSD"
 	ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
 	ksh93 $(atf_get_srcdir)/hotplug_004_pos.ksh || atf_fail "Testcase failed"
 }
@@ -141,6 +144,7 @@ hotplug_005_pos_body()
 	. $(atf_get_srcdir)/hotplug.kshlib
 	. $(atf_get_srcdir)/hotplug.cfg
 
+	atf_skip "TODO: move to the zfsd directory"
 	ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
 	ksh93 $(atf_get_srcdir)/hotplug_005_pos.ksh || atf_fail "Testcase failed"
 }
@@ -167,6 +171,7 @@ hotplug_006_pos_body()
 	. $(atf_get_srcdir)/hotplug.kshlib
 	. $(atf_get_srcdir)/hotplug.cfg
 
+	atf_skip "redundant with hotplug_050_pos"
 	ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
 	ksh93 $(atf_get_srcdir)/hotplug_006_pos.ksh || atf_fail "Testcase failed"
 }
@@ -193,6 +198,7 @@ hotplug_007_pos_body()
 	. $(atf_get_srcdir)/hotplug.kshlib
 	. $(atf_get_srcdir)/hotplug.cfg
 
+	atf_skip "TODO: move to cli_root/zpool_replace"
 	ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
 	ksh93 $(atf_get_srcdir)/hotplug_007_pos.ksh || atf_fail "Testcase failed"
 }
@@ -210,8 +216,7 @@ atf_test_case hotplug_008_pos cleanup
 hotplug_008_pos_head()
 {
 	atf_set "descr" "When removing hotspare device, verify device status is 'REMOVED'."
-	atf_set "require.progs"  zpool lofiadm
-	atf_set "timeout" 1800
+	atf_set "require.progs"  zpool gnop
 }
 hotplug_008_pos_body()
 {
@@ -219,6 +224,7 @@ hotplug_008_pos_body()
 	. $(atf_get_srcdir)/hotplug.kshlib
 	. $(atf_get_srcdir)/hotplug.cfg
 
+	verify_disk_count "$DISKS" 4
 	ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
 	ksh93 $(atf_get_srcdir)/hotplug_008_pos.ksh || atf_fail "Testcase failed"
 }
@@ -245,6 +251,7 @@ hotplug_009_pos_body()
 	. $(atf_get_srcdir)/hotplug.kshlib
 	. $(atf_get_srcdir)/hotplug.cfg
 
+	atf_skip "redundant with zfsd_import_001_pos"
 	ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
 	ksh93 $(atf_get_srcdir)/hotplug_009_pos.ksh || atf_fail "Testcase failed"
 }
@@ -271,6 +278,7 @@ hotplug_010_pos_body()
 	. $(atf_get_srcdir)/hotplug.kshlib
 	. $(atf_get_srcdir)/hotplug.cfg
 
+	atf_skip "redundant with zfsd_replace_001_pos"
 	ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
 	ksh93 $(atf_get_srcdir)/hotplug_010_pos.ksh || atf_fail "Testcase failed"
 }
@@ -288,8 +296,7 @@ atf_test_case hotplug_011_pos cleanup
 hotplug_011_pos_head()
 {
 	atf_set "descr" "Removing device offlined, verify device status is UNAVAIL,when the system is onlined."
-	atf_set "require.progs"  zpool lofiadm svcadm svcs
-	atf_set "timeout" 1800
+	atf_set "require.progs"  zpool gnop
 }
 hotplug_011_pos_body()
 {
@@ -297,6 +304,7 @@ hotplug_011_pos_body()
 	. $(atf_get_srcdir)/hotplug.kshlib
 	. $(atf_get_srcdir)/hotplug.cfg
 
+	verify_disk_count "$DISKS" 4
 	ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
 	ksh93 $(atf_get_srcdir)/hotplug_011_pos.ksh || atf_fail "Testcase failed"
 }

Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/setup.ksh
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/setup.ksh	Mon Jan 29 23:43:04 2018	(r328571)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/setup.ksh	Mon Jan 29 23:53:53 2018	(r328572)
@@ -29,23 +29,5 @@
 
 . $STF_SUITE/tests/hotplug/hotplug.kshlib
 
-if ! $LOFIADM -f > /dev/null 2>&1; then
-	log_unsupported
-fi
-
-verify_runnable "global"
-
-if [[ -d $VDEV_DIR ]]; then
-	log_must $RM -rf $VDEV_DIR
-fi
-
-log_must $MKDIR -p $VDEV_DIR
-log_must $TRUNCATE -s 100M $DEV_FILES $SPARE_FILES $NEWFILE
-log_must create_lofi_device $DEV_FILES $SPARE_FILES
-
-#
-# record repair to resource(s) to cleanup fma faulty
-#
-log_must repair_faulty
-
+log_must create_gnops $ALL_DISKS
 log_pass


More information about the svn-src-projects mailing list