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 2009 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_create
/zpool_create.shlib
37 # Verify zpool add succeed when adding vdevs with matching redundancy.
40 # 1. Create base filesystem to hold virtual disk files.
41 # 2. Create several files == $MINVDEVSIZE.
42 # 3. Create pool with given redundancy.
43 # 3. Verify 'zpool add' succeed with with matching redundancy.
46 verify_runnable
"global"
50 datasetexists
$TESTPOOL1 && destroy_pool
$TESTPOOL1
51 datasetexists
$TESTPOOL && destroy_pool
$TESTPOOL
55 log_assert
"Verify 'zpool add' succeed with keywords combination."
58 create_pool
$TESTPOOL $DISKS
59 mntpnt
=$
(get_prop mountpoint
$TESTPOOL)
63 log_must truncate
-s $MINVDEVSIZE $mntpnt/vdev
$i
65 eval vdev
$i=$mntpnt/vdev
$i
69 set -A redundancy0_create_args \
72 set -A redundancy1_create_args \
73 "mirror $vdev0 $vdev1" \
74 "raidz1 $vdev0 $vdev1"
76 set -A redundancy2_create_args \
77 "mirror $vdev0 $vdev1 $vdev2" \
78 "raidz2 $vdev0 $vdev1 $vdev2"
80 set -A redundancy3_create_args \
81 "mirror $vdev0 $vdev1 $vdev2 $vdev3" \
82 "raidz3 $vdev0 $vdev1 $vdev2 $vdev3"
84 set -A redundancy0_add_args \
88 set -A redundancy1_add_args \
89 "mirror $vdev5 $vdev6" \
90 "raidz1 $vdev5 $vdev6" \
91 "raidz1 $vdev5 $vdev6 mirror $vdev7 $vdev8" \
92 "mirror $vdev5 $vdev6 raidz1 $vdev7 $vdev8"
94 set -A redundancy2_add_args \
95 "mirror $vdev5 $vdev6 $vdev7" \
96 "raidz2 $vdev5 $vdev6 $vdev7"
98 set -A redundancy3_add_args \
99 "mirror $vdev5 $vdev6 $vdev7 $vdev8" \
100 "raidz3 $vdev5 $vdev6 $vdev7 $vdev8"
104 function zpool_create_add
106 typeset
-n create_args
=$1
107 typeset
-n add_args
=$2
110 while ((i
< ${#create_args[@]})); do
112 while ((j
< ${#add_args[@]})); do
113 log_must zpool create
$TESTPOOL1 ${create_args[$i]}
114 log_must zpool add
$TESTPOOL1 ${add_args[$j]}
115 log_must zpool destroy
-f $TESTPOOL1
123 function zpool_create_forced_add
125 typeset
-n create_args
=$1
126 typeset
-n add_args
=$2
129 while ((i
< ${#create_args[@]})); do
131 while ((j
< ${#add_args[@]})); do
132 log_must zpool create
$TESTPOOL1 ${create_args[$i]}
133 log_mustnot zpool add
$TESTPOOL1 ${add_args[$j]}
134 log_must zpool add
-f $TESTPOOL1 ${add_args[$j]}
135 log_must zpool destroy
-f $TESTPOOL1
143 zpool_create_add redundancy0_create_args redundancy0_add_args
144 zpool_create_add redundancy1_create_args redundancy1_add_args
145 zpool_create_add redundancy2_create_args redundancy2_add_args
146 zpool_create_add redundancy3_create_args redundancy3_add_args
148 zpool_create_forced_add redundancy0_create_args redundancy1_add_args
149 zpool_create_forced_add redundancy0_create_args redundancy2_add_args
150 zpool_create_forced_add redundancy0_create_args redundancy3_add_args
152 zpool_create_forced_add redundancy1_create_args redundancy0_add_args
153 zpool_create_forced_add redundancy1_create_args redundancy2_add_args
154 zpool_create_forced_add redundancy1_create_args redundancy3_add_args
156 zpool_create_forced_add redundancy2_create_args redundancy0_add_args
157 zpool_create_forced_add redundancy2_create_args redundancy1_add_args
158 zpool_create_forced_add redundancy2_create_args redundancy3_add_args
160 zpool_create_forced_add redundancy3_create_args redundancy0_add_args
161 zpool_create_forced_add redundancy3_create_args redundancy1_add_args
162 zpool_create_forced_add redundancy3_create_args redundancy2_add_args
164 log_pass
"'zpool add' succeed with keywords combination."