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 2008 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
37 # Pools of correct vdev types accept boot property
40 # 1. create pools of each vdev type (raid, raidz, raidz2, mirror + hotspares)
41 # 2. verify we can set bootfs on each pool type according to design
44 verify_runnable
"global"
47 zpool
set 2>&1 |
grep bootfs
> /dev
/null
50 log_unsupported
"bootfs pool property not supported on this release."
53 VDEV1
=/bootfs_006_pos_a.$$.dat
54 VDEV2
=/bootfs_006_pos_b.$$.dat
55 VDEV3
=/bootfs_006_pos_c.$$.dat
56 VDEV4
=/bootfs_006_pos_d.$$.dat
58 function verify_bootfs
{ # $POOL
60 log_must zfs create
$POOL/$TESTFS
62 log_must zpool
set bootfs
=$POOL/$TESTFS $POOL
63 VAL
=$
(zpool get bootfs
$POOL |
tail -1 |
awk '{print $3}' )
64 if [ $VAL != "$POOL/$TESTFS" ]
66 log_must zpool status
-v $POOL
68 "set/get failed on $POOL - expected $VAL == $POOL/$TESTFS"
70 log_must zpool destroy
$POOL
73 function verify_no_bootfs
{ # $POOL
75 log_must zfs create
$POOL/$TESTFS
76 log_mustnot zpool
set bootfs
=$POOL/$TESTFS $POOL
77 VAL
=$
(zpool get bootfs
$POOL |
tail -1 |
awk '{print $3}' )
78 if [ $VAL == "$POOL/$TESTFS" ]
80 log_must zpool status
-v $POOL
81 log_fail
"set/get unexpectedly failed $VAL != $POOL/$TESTFS"
83 log_must zpool destroy
$POOL
87 if poolexists
$TESTPOOL
89 log_must zpool destroy
$TESTPOOL
91 log_must
rm $VDEV1 $VDEV2 $VDEV3 $VDEV4
94 log_assert
"Pools of correct vdev types accept boot property"
99 log_must mkfile
$MINVDEVSIZE $VDEV1 $VDEV2 $VDEV3 $VDEV4
102 ## the following configurations are supported bootable pools
105 log_must zpool create
$TESTPOOL $VDEV1
106 verify_bootfs
$TESTPOOL
109 log_must zpool create
$TESTPOOL $VDEV1 spare
$VDEV2
110 verify_bootfs
$TESTPOOL
113 log_must zpool create
$TESTPOOL mirror
$VDEV1 $VDEV2
114 verify_bootfs
$TESTPOOL
117 log_must zpool create
$TESTPOOL mirror
$VDEV1 $VDEV2 spare
$VDEV3
118 verify_bootfs
$TESTPOOL
120 ## the following configurations are not supported as bootable pools
123 log_must zpool create
$TESTPOOL $VDEV1 $VDEV2
124 verify_no_bootfs
$TESTPOOL
127 log_must zpool create
$TESTPOOL $VDEV1 $VDEV2 spare
$VDEV3
128 verify_no_bootfs
$TESTPOOL
131 log_must zpool create
$TESTPOOL raidz
$VDEV1 $VDEV2
132 verify_bootfs
$TESTPOOL
135 log_must zpool create
$TESTPOOL raidz
$VDEV1 $VDEV2 spare
$VDEV3
136 verify_bootfs
$TESTPOOL
139 log_must zpool create
$TESTPOOL raidz2
$VDEV1 $VDEV2 $VDEV3
140 verify_bootfs
$TESTPOOL
143 log_must zpool create
$TESTPOOL raidz2
$VDEV1 $VDEV2 $VDEV3 spare
$VDEV4
144 verify_bootfs
$TESTPOOL
146 log_pass
"Pools of correct vdev types accept boot property"