From owner-svn-src-projects@freebsd.org Thu Feb 8 21:00:48 2018 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 144CEF0429E for ; Thu, 8 Feb 2018 21:00:48 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BD4427D51E; Thu, 8 Feb 2018 21:00:47 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B7B521B441; Thu, 8 Feb 2018 21:00:47 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w18L0lU1052837; Thu, 8 Feb 2018 21:00:47 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w18L0lcl052832; Thu, 8 Feb 2018 21:00:47 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201802082100.w18L0lcl052832@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 8 Feb 2018 21:00:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r329030 - in projects/zfsd/head/tests/sys/cddl/zfs/tests: cli_root/zpool_clear zfsd X-SVN-Group: projects X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in projects/zfsd/head/tests/sys/cddl/zfs/tests: cli_root/zpool_clear zfsd X-SVN-Commit-Revision: 329030 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Feb 2018 21:00:48 -0000 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 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()