Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/Makefile =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/Makefile (revision 293688) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/Makefile (revision 293689) @@ -1,35 +1,36 @@ # $FreeBSD$ .include TESTSDIR=${TESTSBASE}/sys/cddl/zfs/tests/cli_root/zpool_import FILESDIR=${TESTSDIR} ATF_TESTS_KSH93+= zpool_import_test FILES+= zpool_import_006_pos.ksh FILES+= zpool_import_002_pos.ksh FILES+= zpool_import_missing_003_pos.ksh FILES+= zpool_import_all_001_pos.ksh FILES+= zpool_import.cfg FILES+= zpool_import_corrupt_001_pos.ksh FILES+= zpool_import_012_pos.ksh FILES+= zpool_import_013_neg.ksh FILES+= zpool_import_007_pos.ksh FILES+= zpool_import_003_pos.ksh FILES+= zpool_import_rename_001_pos.ksh FILES+= zpool_import_missing_002_pos.ksh FILES+= setup.ksh FILES+= zpool_import_010_pos.ksh FILES+= zpool_import_014_pos.ksh FILES+= cleanup.ksh FILES+= zpool_import_011_neg.ksh FILES+= zpool_import_missing_004_pos.ksh +FILES+= zpool_import_missing_005_pos.ksh FILES+= zpool_import_005_pos.ksh FILES+= zpool_import_009_neg.ksh FILES+= zpool_import_missing_001_pos.ksh FILES+= zpool_import_008_pos.ksh FILES+= zpool_import_004_pos.ksh FILES+= zpool_import.kshlib .include Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_missing_005_pos.ksh =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_missing_005_pos.ksh (nonexistent) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_missing_005_pos.ksh (revision 293689) @@ -0,0 +1,122 @@ +#!/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 2016 Spectra Logic All rights reserved. +# Use is subject to license terms. +# + +. $STF_SUITE/include/libtest.kshlib + +################################################################################# +# +# __stc_assertion_start +# +# ID: zpool_import_missing_005_pos +# +# DESCRIPTION: +# Verify that a pool can still be imported even if its devices' names +# have changed, for all types of devices. This is a test of vdev_geom's +# import_by_guid functionality. +# STRATEGY: +# 1. Create a supply of file-backed md devices +# 2. Create a disk-backed pool with regular, cache, log, and spare vdevs +# 3. Export it +# 4. Cause all the md devices names to change +# 5. Verify 'zpool import' can import it +# +# TESTABILITY: explicit +# +# TEST_AUTOMATION_LEVEL: automated +# +# CODING_STATUS: COMPLETED (2015-01-4) +# +# __stc_assertion_end +# +################################################################################ + +verify_runnable "global" + +log_assert "Verify that all types of vdevs of a disk-backed exported pool can be imported even if they have been renamed" + +# Create md devices so we can control their devnames +# Use high devnames so we'll be unlikely to have collisions +typeset -i REGULAR_U=4000 +typeset -i LOG_U=4001 +typeset -i CACHE_U=4002 +typeset -i SPARE_U=4003 +typeset -i REGULAR_ALTU=5000 +typeset -i LOG_ALTU=5001 +typeset -i CACHE_ALTU=5002 +typeset -i SPARE_ALTU=5003 +typeset REGULAR=${TMPDIR}/regular +typeset LOG=${TMPDIR}/log +typeset CACHE=${TMPDIR}/cache +typeset SPARE=${TMPDIR}/spare + +function cleanup +{ + destroy_pool $TESTPOOL + $MDCONFIG -d -u $REGULAR_U 2>/dev/null + $MDCONFIG -d -u $LOG_U 2>/dev/null + $MDCONFIG -d -u $CACHE_U 2>/dev/null + $MDCONFIG -d -u $SPARE_U 2>/dev/null + $MDCONFIG -d -u $REGULAR_ALTU 2>/dev/null + $MDCONFIG -d -u $LOG_ALTU 2>/dev/null + $MDCONFIG -d -u $CACHE_ALTU 2>/dev/null + $MDCONFIG -d -u $SPARE_ALTU 2>/dev/null + $RM -f $REGULAR + $RM -f $CACHE + $RM -f $LOG + $RM -f $SPARE +} +log_onexit cleanup + +log_must $MKFILE 64m $REGULAR +log_must $MKFILE 64m $LOG +log_must $MKFILE 64m $CACHE +log_must $MKFILE 64m $SPARE +log_must $MDCONFIG -t vnode -a -f $REGULAR -u $REGULAR_U +log_must $MDCONFIG -t vnode -a -f $LOG -u $LOG_U +log_must $MDCONFIG -t vnode -a -f $CACHE -u $CACHE_U +log_must $MDCONFIG -t vnode -a -f $SPARE -u $SPARE_U + +log_must $ZPOOL create $TESTPOOL md$REGULAR_U log md$LOG_U cache md$CACHE_U spare md$SPARE_U +log_must $ZPOOL export $TESTPOOL +# Now destroy the md devices, then recreate them with different names +log_must $MDCONFIG -d -u $REGULAR_U +log_must $MDCONFIG -d -u $LOG_U +log_must $MDCONFIG -d -u $CACHE_U +log_must $MDCONFIG -d -u $SPARE_U +log_must $MDCONFIG -t vnode -a -f $REGULAR -u $REGULAR_ALTU +log_must $MDCONFIG -t vnode -a -f $LOG -u $LOG_ALTU +log_must $MDCONFIG -t vnode -a -f $CACHE -u $CACHE_ALTU +log_must $MDCONFIG -t vnode -a -f $SPARE -u $SPARE_ALTU + +log_must $ZPOOL import $TESTPOOL +zpool status $TESTPOOL +log_must check_state $TESTPOOL md${REGULAR_ALTU} ONLINE +log_must check_state $TESTPOOL md${LOG_ALTU} ONLINE +log_must check_state $TESTPOOL md${CACHE_ALTU} ONLINE +log_must check_state $TESTPOOL md${SPARE_ALTU} AVAIL + +log_pass Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_test.sh =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_test.sh (revision 293688) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_test.sh (revision 293689) @@ -1,597 +1,614 @@ # 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 2012 Spectra Logic. All rights reserved. # Use is subject to license terms. # atf_test_case zpool_import_002_pos cleanup zpool_import_002_pos_head() { atf_set "descr" "Verify that an exported pool can be imported and cannot be imported more than once." atf_set "require.config" rt_medium atf_set "require.config" at_least_2_disks atf_set "require.progs" zfs zpool sum mkfile zdb atf_set "timeout" 2400 } zpool_import_002_pos_body() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_002_pos.ksh || atf_fail "Testcase failed" } zpool_import_002_pos_cleanup() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_003_pos cleanup zpool_import_003_pos_head() { atf_set "descr" "Destroyed pools are not listed unless with -D option is specified." atf_set "require.config" rt_medium atf_set "require.config" at_least_2_disks atf_set "require.progs" mkfile zpool zfs atf_set "timeout" 2400 } zpool_import_003_pos_body() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_003_pos.ksh || atf_fail "Testcase failed" } zpool_import_003_pos_cleanup() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_004_pos cleanup zpool_import_004_pos_head() { atf_set "descr" "Destroyed pools devices was moved to another directory,it still can be imported correctly." atf_set "require.config" rt_medium atf_set "require.config" at_least_2_disks atf_set "require.progs" mkfile zpool zfs zdb atf_set "timeout" 2400 } zpool_import_004_pos_body() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_004_pos.ksh || atf_fail "Testcase failed" } zpool_import_004_pos_cleanup() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_005_pos cleanup zpool_import_005_pos_head() { atf_set "descr" "Destroyed pools devices was renamed, it still can be importedcorrectly." atf_set "require.config" rt_medium atf_set "require.config" at_least_2_disks atf_set "require.progs" mkfile zpool zfs zdb atf_set "timeout" 2400 } zpool_import_005_pos_body() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_005_pos.ksh || atf_fail "Testcase failed" } zpool_import_005_pos_cleanup() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_006_pos cleanup zpool_import_006_pos_head() { atf_set "descr" "For mirror, N-1 destroyed pools devices was removed or usedby other pool, it still can be imported correctly." atf_set "require.config" rt_medium atf_set "require.config" at_least_2_disks atf_set "require.progs" mkfile zpool zfs zdb atf_set "timeout" 2400 } zpool_import_006_pos_body() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_006_pos.ksh || atf_fail "Testcase failed" } zpool_import_006_pos_cleanup() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_007_pos cleanup zpool_import_007_pos_head() { atf_set "descr" "For raidz, one destroyed pools devices was removed or used byother pool, it still can be imported correctly." atf_set "require.config" rt_medium atf_set "require.config" at_least_2_disks atf_set "require.progs" mkfile zpool zfs zdb atf_set "timeout" 2400 } zpool_import_007_pos_body() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_007_pos.ksh || atf_fail "Testcase failed" } zpool_import_007_pos_cleanup() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_008_pos cleanup zpool_import_008_pos_head() { atf_set "descr" "For raidz2, two destroyed pools devices was removed or used byother pool, it still can be imported correctly." atf_set "require.config" rt_medium atf_set "require.config" at_least_2_disks atf_set "require.progs" mkfile zpool zfs zdb atf_set "timeout" 2400 } zpool_import_008_pos_body() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_008_pos.ksh || atf_fail "Testcase failed" } zpool_import_008_pos_cleanup() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_009_neg cleanup zpool_import_009_neg_head() { atf_set "descr" "Badly-formed 'zpool import' with inapplicable scenariosshould return an error." atf_set "require.config" rt_medium atf_set "require.config" at_least_2_disks atf_set "require.progs" zfs zpool mkfile atf_set "timeout" 2400 } zpool_import_009_neg_body() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_009_neg.ksh || atf_fail "Testcase failed" } zpool_import_009_neg_cleanup() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_010_pos cleanup zpool_import_010_pos_head() { atf_set "descr" "'zpool -D -a' can import all the specified directoriesdestroyed pools." atf_set "require.config" rt_medium atf_set "require.config" at_least_2_disks atf_set "require.progs" mkfile zpool zfs atf_set "timeout" 2400 } zpool_import_010_pos_body() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_010_pos.ksh || atf_fail "Testcase failed" } zpool_import_010_pos_cleanup() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_011_neg cleanup zpool_import_011_neg_head() { atf_set "descr" "For strip pool, any destroyed pool devices was demaged,zpool import -D will failed." atf_set "require.config" rt_medium atf_set "require.config" at_least_2_disks atf_set "require.progs" mkfile zpool zfs zdb atf_set "timeout" 2400 } zpool_import_011_neg_body() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_011_neg.ksh || atf_fail "Testcase failed" } zpool_import_011_neg_cleanup() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_012_pos cleanup zpool_import_012_pos_head() { atf_set "descr" "Verify all mount & share status of sub-filesystems within a poolcan be restored after import [-Df]." atf_set "require.config" rt_medium atf_set "require.config" at_least_2_disks atf_set "require.progs" zfs zpool mkfile zdb share atf_set "timeout" 2400 } zpool_import_012_pos_body() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_012_pos.ksh || atf_fail "Testcase failed" } zpool_import_012_pos_cleanup() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_013_neg cleanup zpool_import_013_neg_head() { atf_set "descr" "'zpool import' fail while pool may be in use from other system,it need import forcefully." atf_set "require.config" rt_medium atf_set "require.config" at_least_2_disks atf_set "require.progs" zfs zpool mkfile atf_set "timeout" 2400 } zpool_import_013_neg_body() { atf_expect_fail 'BUG26195: "zpool import" without "-f" will import foreign, in-use, downrev pools' export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_013_neg.ksh || atf_fail "Testcase failed" } zpool_import_013_neg_cleanup() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_014_pos cleanup zpool_import_014_pos_head() { atf_set "descr" "'zpool import' can import destroyed disk-backed pools" atf_set "require.config" rt_short atf_set "require.config" at_least_1_disks atf_set "require.progs" zfs zpool } zpool_import_014_pos_body() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/zpool_import_014_pos.ksh || atf_fail "Testcase failed" } zpool_import_014_pos_cleanup() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_all_001_pos cleanup zpool_import_all_001_pos_head() { atf_set "descr" "Verify that 'zpool import -a' succeeds as root." atf_set "require.config" rt_medium atf_set "require.config" at_least_2_disks atf_set "require.progs" zfs zpool sum mkfile atf_set "timeout" 2400 } zpool_import_all_001_pos_body() { atf_skip "This test relies heavily on Solaris slices. It could be ported, but that is difficult due to the high degree of obfuscation in the code" export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_all_001_pos.ksh || atf_fail "Testcase failed" } zpool_import_all_001_pos_cleanup() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_missing_001_pos cleanup zpool_import_missing_001_pos_head() { atf_set "descr" "Verify that import could handle damaged or missing device." atf_set "require.config" rt_medium atf_set "require.config" at_least_2_disks atf_set "require.progs" mkfile zfs sum zpool zdb atf_set "timeout" 2400 } zpool_import_missing_001_pos_body() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_missing_001_pos.ksh || atf_fail "Testcase failed" } zpool_import_missing_001_pos_cleanup() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_missing_002_pos cleanup zpool_import_missing_002_pos_head() { atf_set "descr" "Verify that import could handle moving device." atf_set "require.config" rt_medium atf_set "require.config" at_least_2_disks atf_set "require.progs" mkfile zpool zfs zdb atf_set "timeout" 2400 } zpool_import_missing_002_pos_body() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_missing_002_pos.ksh || atf_fail "Testcase failed" } zpool_import_missing_002_pos_cleanup() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_missing_003_pos cleanup zpool_import_missing_003_pos_head() { atf_set "descr" "Verify that import could handle device overlapped." atf_set "require.config" rt_medium atf_set "require.config" at_least_2_disks atf_set "require.progs" mkfile zpool sum zfs atf_set "timeout" 2400 } zpool_import_missing_003_pos_body() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_missing_003_pos.ksh || atf_fail "Testcase failed" } zpool_import_missing_003_pos_cleanup() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_missing_004_pos zpool_import_missing_004_pos_head() { atf_set "descr" "Verify that zpool import succeeds when devices are missing" atf_set "require.config" rt_short atf_set "require.progs" mkfile zfs zpool atf_set "timeout" 300 } zpool_import_missing_004_pos_body() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/zpool_import_missing_004_pos.ksh || atf_fail "Testcase failed" } +atf_test_case zpool_import_missing_005_pos +zpool_import_missing_005_pos_head() +{ + atf_set "descr" "Verify that zpool import succeeds when devices of all types have been renamed" + atf_set "require.progs" mkfile mdconfig zfs zpool + atf_set "timeout" 300 +} +zpool_import_missing_005_pos_body() +{ + export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") + . $(atf_get_srcdir)/../../../include/default.cfg + . $(atf_get_srcdir)/zpool_import.cfg + ksh93 $(atf_get_srcdir)/zpool_import_missing_005_pos.ksh || atf_fail "Testcase failed" +} + + atf_test_case zpool_import_rename_001_pos cleanup zpool_import_rename_001_pos_head() { atf_set "descr" "Verify that an imported pool can be renamed." atf_set "require.config" rt_medium atf_set "require.config" at_least_2_disks atf_set "require.progs" zfs zpool sum mkfile zdb atf_set "timeout" 2400 } zpool_import_rename_001_pos_body() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_rename_001_pos.ksh || atf_fail "Testcase failed" } zpool_import_rename_001_pos_cleanup() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_corrupt_001_pos cleanup zpool_import_corrupt_001_pos_head() { atf_set "descr" "Verify that a disk-backed exported pool with some of its vdev labels corrupted can still be imported" atf_set "require.config" rt_medium atf_set "require.config" at_least_1_disks atf_set "require.progs" zfs zpool zdb atf_set "timeout" 2400 } zpool_import_corrupt_001_pos_body() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/zpool_import_corrupt_001_pos.ksh || atf_fail "Testcase failed" } zpool_import_corrupt_001_pos_cleanup() { export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_init_test_cases() { atf_add_test_case zpool_import_002_pos atf_add_test_case zpool_import_003_pos atf_add_test_case zpool_import_004_pos atf_add_test_case zpool_import_005_pos atf_add_test_case zpool_import_006_pos atf_add_test_case zpool_import_007_pos atf_add_test_case zpool_import_008_pos atf_add_test_case zpool_import_009_neg atf_add_test_case zpool_import_010_pos atf_add_test_case zpool_import_011_neg atf_add_test_case zpool_import_012_pos atf_add_test_case zpool_import_013_neg atf_add_test_case zpool_import_014_pos atf_add_test_case zpool_import_all_001_pos atf_add_test_case zpool_import_missing_001_pos atf_add_test_case zpool_import_missing_002_pos atf_add_test_case zpool_import_missing_003_pos atf_add_test_case zpool_import_missing_004_pos + atf_add_test_case zpool_import_missing_005_pos atf_add_test_case zpool_import_rename_001_pos atf_add_test_case zpool_import_corrupt_001_pos }