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 (c) 2016 by Delphix. All rights reserved.
26 .
$STF_SUITE/include
/libtest.shlib
27 .
$STF_SUITE/tests
/functional
/cli_root
/zpool_initialize
/zpool_initialize.kshlib
31 # Attempting to initialize unsupported vdevs should fail.
34 # 1. Create a pool with the following configuration:
43 # 2. Try to initialize vdev1, vdev2, and vdev3. Ensure that all 3 fail.
47 if datasetexists
$TESTPOOL; then
48 log_must zpool destroy
-f $TESTPOOL
50 if [[ -d $TESTDIR ]]; then
51 log_must
rm -rf $TESTDIR
56 log_must mkdir
$TESTDIR
59 log_must mkfile
$MINVDEVSIZE $TESTDIR/vdev
$n
60 FDISKS
+=("$TESTDIR/vdev$n")
62 FDISKS
+=("${DISKS%% *}")
64 log_must zpool create
$TESTPOOL mirror
${FDISKS[0]} ${FDISKS[1]} \
65 spare
${FDISKS[2]} cache
${FDISKS[3]}
67 log_must zpool offline
$TESTPOOL ${FDISKS[1]}
69 log_mustnot zpool initialize
$TESTPOOL mirror-0
71 log_mustnot zpool initialize
$TESTPOOL ${FDISKS[$n]}
74 log_pass
"Attempting to initialize failed on unsupported devices"