svn commit: r329030 - in projects/zfsd/head/tests/sys/cddl/zfs/tests: cli_root/zpool_clear zfsd

Alan Somers asomers at FreeBSD.org
Thu Feb 8 21:00:48 UTC 2018


Author: asomers
Date: Thu Feb  8 21:00:47 2018
New Revision: 329030
URL: https://svnweb.freebsd.org/changeset/base/329030

Log:
  Add zpool_clear_005_pos
  
  It tests that "zpool clear" can reactivate a suspended pool after all vdevs
  have disappeared and then returned.  It's nearly identical to
  zfsd_replace_002_pos, but tests manual reactivation rather than automatic
  reactivation.
  
  tests/sys/cddl/zfs/tests/cli_root/zpool_clear/Makefile
  tests/sys/cddl/zfs/tests/cli_root/zpool_clear/zpool_clear_005_pos.ksh
  tests/sys/cddl/zfs/tests/cli_root/zpool_clear/zpool_clear_test.sh
  	Add the new test
  
  tests/sys/cddl/zfs/tests/zfsd/zfsd_replace_002_pos.ksh
  tests/sys/cddl/zfs/tests/zfsd/zfsd_test.sh
  	Improve some test descriptions
  
  Sponsored by:	Spectra Logic Corp

Added:
  projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/zpool_clear_005_pos.ksh
Modified:
  projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/Makefile
  projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/zpool_clear_test.sh
  projects/zfsd/head/tests/sys/cddl/zfs/tests/zfsd/zfsd_replace_002_pos.ksh
  projects/zfsd/head/tests/sys/cddl/zfs/tests/zfsd/zfsd_test.sh

Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/Makefile
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/Makefile	Thu Feb  8 20:28:30 2018	(r329029)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/Makefile	Thu Feb  8 21:00:47 2018	(r329030)
@@ -15,5 +15,6 @@ ${PACKAGE}FILES+=	zpool_clear.cfg
 ${PACKAGE}FILES+=	zpool_clear_001_pos.ksh
 ${PACKAGE}FILES+=	setup.ksh
 ${PACKAGE}FILES+=	zpool_clear_004_pos.ksh
+${PACKAGE}FILES+=	zpool_clear_005_pos.ksh
 
 .include <bsd.test.mk>

Added: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/zpool_clear_005_pos.ksh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/zpool_clear_005_pos.ksh	Thu Feb  8 21:00:47 2018	(r329030)
@@ -0,0 +1,77 @@
+#!/usr/local/bin/ksh93 -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# Copyright 2012-2018 Spectra Logic Corporation.  All rights reserved.
+# Use is subject to license terms.
+# 
+# Portions taken from:
+# ident	"@(#)replacement_001_pos.ksh	1.4	08/02/27 SMI"
+#
+# $Id$
+# $FreeBSD$
+
+. $STF_SUITE/include/libtest.kshlib
+. $STF_SUITE/include/libgnop.kshlib
+
+function is_pool_unavail # pool
+{
+	is_pool_state "$1" "UNAVAIL"
+}
+
+log_assert "A pool can come back online after all disks are failed and reactivated"
+
+set_disks
+typeset ALLDISKS="${DISK0} ${DISK1} ${DISK2}"
+typeset ALLNOPS=${ALLDISKS//~(E)([[:space:]]+|$)/.nop\1}
+
+log_must create_gnops $ALLDISKS
+for type in "raidz" "mirror"; do
+	# Create a pool on the supplied disks
+	create_pool $TESTPOOL $type $ALLNOPS
+	log_must $ZFS create $TESTPOOL/$TESTFS
+	log_must $ZFS set mountpoint=$TESTDIR $TESTPOOL/$TESTFS
+
+	# Disable all vdevs.  The pool should become UNAVAIL
+	log_must destroy_gnop $DISK0
+	log_must destroy_gnop $DISK1
+	log_must destroy_gnop $DISK2
+	wait_for 5 1 is_pool_unavail $TESTPOOL
+
+	# Renable all vdevs.  The pool should become healthy again
+	log_must create_gnop $DISK0
+	log_must create_gnop $DISK1
+	log_must create_gnop $DISK2
+
+	# Manually online the pool
+	log_must $ZPOOL clear $TESTPOOL
+
+	wait_for 5 1 is_pool_healthy $TESTPOOL
+
+	destroy_pool $TESTPOOL
+	log_must $RM -rf /$TESTPOOL
+done
+
+log_pass

Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/zpool_clear_test.sh
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/zpool_clear_test.sh	Thu Feb  8 20:28:30 2018	(r329029)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/zpool_clear_test.sh	Thu Feb  8 21:00:47 2018	(r329030)
@@ -119,8 +119,30 @@ zpool_clear_004_pos_cleanup()
 	ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed"
 }
 
+atf_test_case zpool_clear_005_pos cleanup
+zpool_clear_005_pos_head()
+{
+	atf_set "descr" "'zpool clear' can online an UNAVAIL pool after all vdevs have reappeared"
+	atf_set "require.progs"  gnop zpool
+}
+zpool_clear_005_pos_body()
+{
+	. $(atf_get_srcdir)/../../../include/default.cfg
+	. $(atf_get_srcdir)/zpool_clear.cfg
 
+	ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
+	ksh93 $(atf_get_srcdir)/zpool_clear_005_pos.ksh || atf_fail "Testcase failed"
+}
+zpool_clear_005_pos_cleanup()
+{
+	. $(atf_get_srcdir)/../../../include/default.cfg
+	. $(atf_get_srcdir)/zpool_clear.cfg
 
+	ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed"
+}
+
+
+
 atf_init_test_cases()
 {
 
@@ -128,4 +150,5 @@ atf_init_test_cases()
 	atf_add_test_case zpool_clear_002_neg
 	atf_add_test_case zpool_clear_003_neg
 	atf_add_test_case zpool_clear_004_pos
+	atf_add_test_case zpool_clear_005_pos
 }

Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/zfsd/zfsd_replace_002_pos.ksh
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/zfsd/zfsd_replace_002_pos.ksh	Thu Feb  8 20:28:30 2018	(r329029)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zfsd/zfsd_replace_002_pos.ksh	Thu Feb  8 21:00:47 2018	(r329030)
@@ -40,7 +40,7 @@ function is_pool_unavail # pool
 	is_pool_state "$1" "UNAVAIL"
 }
 
-log_assert "A pool can come back online after all disks are failed and reactivated"
+log_assert "zfsd will reactivate a pool after all disks are failed and reappeared"
 
 log_unsupported "This feature has not yet been implemented in zfsd"
 

Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/zfsd/zfsd_test.sh
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/zfsd/zfsd_test.sh	Thu Feb  8 20:28:30 2018	(r329029)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zfsd/zfsd_test.sh	Thu Feb  8 21:00:47 2018	(r329030)
@@ -469,7 +469,7 @@ zfsd_replace_001_pos_cleanup()
 atf_test_case zfsd_replace_002_pos cleanup
 zfsd_replace_002_pos_head()
 {
-	atf_set "descr" "A pool can come back online after all disks have dissapeared and reappeared"
+	atf_set "descr" "zfsd will reactivate a pool after all disks are failed and reappeared"
 	atf_set "require.progs"  zpool camcontrol zfsd zfs
 }
 zfsd_replace_002_pos_body()


More information about the svn-src-projects mailing list