]>
git.proxmox.com Git - mirror_zfs.git/blob - tests/zfs-tests/tests/functional/bootfs/bootfs_006_pos.ksh
fc3ca142f8f0346eab0c85b1908620c23d8e54ec
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.
28 .
$STF_SUITE/include
/libtest.shlib
33 # Pools of correct vdev types accept boot property
36 # 1. create pools of each vdev type (raid, raidz, raidz2, mirror + hotspares)
37 # 2. verify we can set bootfs on each pool type according to design
40 verify_runnable
"global"
43 $ZPOOL set 2>&1 |
$GREP bootfs
> /dev
/null
46 log_unsupported
"bootfs pool property not supported on this release."
49 VDEV1
=$TESTDIR/bootfs_006_pos_a.$$.dat
50 VDEV2
=$TESTDIR/bootfs_006_pos_b.$$.dat
51 VDEV3
=$TESTDIR/bootfs_006_pos_c.$$.dat
52 VDEV4
=$TESTDIR/bootfs_006_pos_d.$$.dat
54 function verify_bootfs
{ # $POOL
56 log_must
$ZFS create
$POOL/$TESTFS
58 log_must
$ZPOOL set bootfs
=$POOL/$TESTFS $POOL
59 VAL
=$
($ZPOOL get bootfs
$POOL |
$TAIL -1 |
$AWK '{print $3}' )
60 if [ $VAL != "$POOL/$TESTFS" ]
62 log_must
$ZPOOL status
-v $POOL
64 "set/get failed on $POOL - expected $VAL == $POOL/$TESTFS"
66 log_must
$ZPOOL destroy
$POOL
69 function verify_no_bootfs
{ # $POOL
71 log_must
$ZFS create
$POOL/$TESTFS
72 log_mustnot
$ZPOOL set bootfs
=$POOL/$TESTFS $POOL
73 VAL
=$
($ZPOOL get bootfs
$POOL |
$TAIL -1 |
$AWK '{print $3}' )
74 if [ $VAL == "$POOL/$TESTFS" ]
76 log_must
$ZPOOL status
-v $POOL
77 log_fail
"set/get unexpectedly failed $VAL != $POOL/$TESTFS"
79 log_must
$ZPOOL destroy
$POOL
83 if poolexists
$TESTPOOL
85 log_must
$ZPOOL destroy
$TESTPOOL
87 log_must
$RM $VDEV1 $VDEV2 $VDEV3 $VDEV4
90 log_assert
"Pools of correct vdev types accept boot property"
95 log_must
$MKFILE 64m
$VDEV1 $VDEV2 $VDEV3 $VDEV4
98 ## the following configurations are supported bootable pools
101 log_must
$ZPOOL create
$TESTPOOL $VDEV1
102 verify_bootfs
$TESTPOOL
105 log_must
$ZPOOL create
$TESTPOOL $VDEV1 spare
$VDEV2
106 verify_bootfs
$TESTPOOL
109 log_must
$ZPOOL create
$TESTPOOL mirror
$VDEV1 $VDEV2
110 verify_bootfs
$TESTPOOL
113 log_must
$ZPOOL create
$TESTPOOL mirror
$VDEV1 $VDEV2 spare
$VDEV3
114 verify_bootfs
$TESTPOOL
116 ## the following configurations are not supported as bootable pools
119 log_must
$ZPOOL create
$TESTPOOL $VDEV1 $VDEV2
120 verify_no_bootfs
$TESTPOOL
123 log_must
$ZPOOL create
$TESTPOOL $VDEV1 $VDEV2 spare
$VDEV3
124 verify_no_bootfs
$TESTPOOL
127 log_must
$ZPOOL create
$TESTPOOL raidz
$VDEV1 $VDEV2
128 verify_no_bootfs
$TESTPOOL
131 log_must
$ZPOOL create
$TESTPOOL raidz
$VDEV1 $VDEV2 spare
$VDEV3
132 verify_no_bootfs
$TESTPOOL
135 log_must
$ZPOOL create
$TESTPOOL raidz2
$VDEV1 $VDEV2 $VDEV3
136 verify_no_bootfs
$TESTPOOL
139 log_must
$ZPOOL create
$TESTPOOL raidz2
$VDEV1 $VDEV2 $VDEV3 spare
$VDEV4
140 verify_no_bootfs
$TESTPOOL
142 log_pass
"Pools of correct vdev types accept boot property"