Date: Mon, 29 Jan 2018 23:36:05 +0000 (UTC) From: Alan Somers <asomers@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r328570 - projects/zfsd/head/tests/sys/cddl/zfs/tests/zfsd Message-ID: <201801292336.w0TNa5cf059809@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: asomers Date: Mon Jan 29 23:36:05 2018 New Revision: 328570 URL: https://svnweb.freebsd.org/changeset/base/328570 Log: Add a regression test for PR 225547 zfsd(8) shouldn't add a spare to a replacing vdev tests/sys/cddl/zfs/tests/zfsd/Makefile tests/sys/cddl/zfs/tests/zfsd/zfsd_hotspare_008_neg.ksh tests/sys/cddl/zfs/tests/zfsd/zfsd_test.sh Add a test case to check that zfsd shouldn't activate a spare for a child of a replacing vdev. Fixing zfsd itself is still TODO. PR: 225547 Sponsored by: Spectra Logic Corp Added: projects/zfsd/head/tests/sys/cddl/zfs/tests/zfsd/zfsd_hotspare_008_neg.ksh Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/zfsd/Makefile projects/zfsd/head/tests/sys/cddl/zfs/tests/zfsd/zfsd_test.sh Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/zfsd/Makefile ============================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/zfsd/Makefile Mon Jan 29 23:20:29 2018 (r328569) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zfsd/Makefile Mon Jan 29 23:36:05 2018 (r328570) @@ -27,6 +27,7 @@ ${PACKAGE}FILES+= zfsd_hotspare_004_pos.ksh ${PACKAGE}FILES+= zfsd_hotspare_005_pos.ksh ${PACKAGE}FILES+= zfsd_hotspare_006_pos.ksh ${PACKAGE}FILES+= zfsd_hotspare_007_pos.ksh +${PACKAGE}FILES+= zfsd_hotspare_008_neg.ksh ${PACKAGE}FILES+= zfsd_import_001_pos.ksh ${PACKAGE}FILES+= zfsd_replace_001_pos.ksh ${PACKAGE}FILES+= zfsd_replace_002_pos.ksh Added: projects/zfsd/head/tests/sys/cddl/zfs/tests/zfsd/zfsd_hotspare_008_neg.ksh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zfsd/zfsd_hotspare_008_neg.ksh Mon Jan 29 23:36:05 2018 (r328570) @@ -0,0 +1,81 @@ +#!/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 2017 Spectra Logic. All rights reserved. +# Use is subject to license terms. + +. $STF_SUITE/tests/hotspare/hotspare.kshlib + +verify_runnable "global" + +function cleanup +{ + $ZPOOL status $TESTPOOL + if poolexists $TESTPOOL ; then + destroy_pool $TESTPOOL + fi + + partition_cleanup +} + +function verify_assertion # damage_type +{ + typeset mntp=$(get_prop mountpoint $TESTPOOL) + + # Write some data to the pool so the replacing vdev doesn't complete + # immediately. + $TIMEOUT 60s $DD if=/dev/zero of=$mntp/zerofile bs=131072 + + log_must $ZINJECT -d $FAULT_DISK -A fault $TESTPOOL + log_must check_state $TESTPOOL $FAULT_DISK FAULTED + + # Replace the failed device. Realistically, the new device would have + # the same physical path as the failed one, but it doesn't matter for + # our purposes. + log_must $ZPOOL replace $TESTPOOL $FAULT_DISK $REPLACEMENT_DISK + + # Add the spare, and check that it does not activate + log_must $ZPOOL add $TESTPOOL spare $SDEV + + # Wait a few seconds before verifying the state + $SLEEP 10 + log_must check_state $TESTPOOL "$SDEV" "AVAIL" +} + +log_onexit cleanup + +log_assert "zfsd will not use newly added spares on replacing vdevs" + +ensure_zfsd_running + +typeset FAULT_DISK=$DISK0 +typeset REPLACEMENT_DISK=$DISK2 +typeset SDEV=$DISK3 +typeset POOLDEVS="$DISK0 $DISK1" +set -A MY_KEYWORDS "mirror" +for keyword in "${MY_KEYWORDS[@]}" ; do + log_must create_pool $TESTPOOL $keyword $POOLDEVS + verify_assertion + + destroy_pool "$TESTPOOL" +done 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 Mon Jan 29 23:20:29 2018 (r328569) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zfsd/zfsd_test.sh Mon Jan 29 23:36:05 2018 (r328570) @@ -318,6 +318,37 @@ zfsd_hotspare_007_pos_cleanup() ksh93 $(atf_get_srcdir)/hotspare_cleanup.ksh || atf_fail "Cleanup failed" } +atf_test_case zfsd_hotspare_008_neg cleanup +zfsd_hotspare_008_neg_head() +{ + atf_set "descr" "zfsd will not use newly added spares on replacing vdevs" + atf_set "require.progs" zpool zfsd + atf_set "timeout" 3600 +} +zfsd_hotspare_008_neg_body() +{ + . $(atf_get_srcdir)/../../include/default.cfg + . $(atf_get_srcdir)/../hotspare/hotspare.kshlib + . $(atf_get_srcdir)/../hotspare/hotspare.cfg + + atf_expect_fail "PR 225547 zfsd shouldn't add a spare to a replacing vdev" + verify_disk_count "$DISKS" 4 + ksh93 $(atf_get_srcdir)/hotspare_setup.ksh || atf_fail "Setup failed" + ksh93 $(atf_get_srcdir)/zfsd_hotspare_008_neg.ksh + if [[ $? != 0 ]]; then + save_artifacts + atf_fail "Testcase failed" + fi +} +zfsd_hotspare_008_neg_cleanup() +{ + . $(atf_get_srcdir)/../../include/default.cfg + . $(atf_get_srcdir)/../hotspare/hotspare.kshlib + . $(atf_get_srcdir)/../hotspare/hotspare.cfg + + ksh93 $(atf_get_srcdir)/hotspare_cleanup.ksh || atf_fail "Cleanup failed" +} + atf_test_case zfsd_autoreplace_001_neg cleanup zfsd_autoreplace_001_neg_head() { @@ -536,6 +567,7 @@ atf_init_test_cases() atf_add_test_case zfsd_hotspare_005_pos atf_add_test_case zfsd_hotspare_006_pos atf_add_test_case zfsd_hotspare_007_pos + atf_add_test_case zfsd_hotspare_008_neg atf_add_test_case zfsd_autoreplace_001_neg atf_add_test_case zfsd_autoreplace_002_pos atf_add_test_case zfsd_autoreplace_003_pos
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801292336.w0TNa5cf059809>