5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
24 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
29 # Copyright (c) 2012, 2016 by Delphix. All rights reserved.
32 . $STF_SUITE/include/libtest.shlib
33 . $STF_SUITE/tests/functional/cli_root/zpool_import/zpool_import.cfg
37 # 'zpool -D -a' can import all the specified directories destroyed pools.
40 # 1. Create a 5 ways mirror pool A with dev0/1/2/3/4, then destroy it.
41 # 2. Create a stripe pool B with dev1. Then destroy it.
42 # 3. Create a raidz2 pool C with dev2/3/4. Then destroy it.
43 # 4. Create a raidz pool D with dev3/4. Then destroy it.
44 # 5. Create a stripe pool E with dev4. Then destroy it.
45 # 6. Verify 'zpool import -D -a' recover all the pools.
48 verify_runnable "global"
53 for dt in $poolE $poolD $poolC $poolB $poolA; do
57 log_must rm -rf $DEVICE_DIR/*
59 while (( i < $MAX_NUM )); do
60 log_must mkfile $FILE_SIZE ${DEVICE_DIR}/${DEVICE_FILE}$i
65 log_assert "'zpool -D -a' can import all the specified directories " \
69 poolA=poolA.$$; poolB=poolB.$$; poolC=poolC.$$; poolD=poolD.$$; poolE=poolE.$$
71 log_must zpool create $poolA mirror $VDEV0 $VDEV1 $VDEV2 $VDEV3 $VDEV4
72 log_must zpool destroy $poolA
74 log_must zpool create $poolB $VDEV1
75 log_must zpool destroy $poolB
77 log_must zpool create $poolC raidz2 $VDEV2 $VDEV3 $VDEV4
78 log_must zpool destroy $poolC
80 log_must zpool create $poolD raidz $VDEV3 $VDEV4
81 log_must zpool destroy $poolD
83 log_must zpool create $poolE $VDEV4
84 log_must zpool destroy $poolE
86 log_must zpool import -d $DEVICE_DIR -D -f -a
88 for dt in $poolA $poolB $poolC $poolD $poolE; do
89 log_must datasetexists $dt
92 log_pass "'zpool -D -a' test passed."