1 #!/usr/local/bin/ksh93 -p
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]
26 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
27 # Use is subject to license terms.
29 # ident "@(#)largest_pool_001_pos.ksh 1.6 09/06/22 SMI"
31 . $STF_SUITE/include/libtest.kshlib
33 # ##########################################################################
35 # start __stf_assertion__
37 # ASSERTION: largest_pool_001
40 # The largest pool can be created and a dataset in that
41 # pool can be created and mounted.
44 # create a pool which will contain a volume device.
45 # create a volume device of desired sizes.
46 # create the largest pool allowed using the volume vdev.
47 # create and mount a dataset in the largest pool.
48 # create some files in the zfs file system.
49 # do some zpool list commands and parse the output.
51 # end __stf_assertion__
53 # ##########################################################################
55 verify_runnable "global"
58 # Parse the results of zpool & zfs creation with specified size
66 function parse_expected_output
68 UNITS=`$ECHO $1 | $SED -e 's/^\([0-9].*\)\([a-z].\)/\2/'`
78 log_note "Detect zpool $TESTPOOL in this test machine."
79 log_must eval "$ZPOOL list $TESTPOOL > $TMPDIR/j.${TESTCASE_ID}"
80 log_must eval "$GREP $TESTPOOL $TMPDIR/j.${TESTCASE_ID} | \
81 $AWK '{print $2}' | $GREP $CHKUNIT"
83 log_note "Detect the file system in this test machine."
84 log_must eval "$DF -t zfs -h > $TMPDIR/j.${TESTCASE_ID}"
85 log_must eval "$GREP $TESTPOOL $TMPDIR/j.${TESTCASE_ID} | \
86 $AWK '{print $2}' | $GREP $CHKUNIT"
92 # Check and destroy zfs, volume & zpool remove the temporary files
96 log_note "Start cleanup the zfs and pool"
98 if datasetexists $TESTPOOL/$TESTFS ; then
99 if ismounted $TESTPOOL/$TESTFS ; then
100 log_must $ZFS unmount $TESTPOOL/$TESTFS
102 log_must $ZFS destroy $TESTPOOL/$TESTFS
105 destroy_pool $TESTPOOL
107 datasetexists $TESTPOOL2/$TESTVOL && \
108 log_must $ZFS destroy $TESTPOOL2/$TESTVOL
110 destroy_pool $TESTPOOL2
112 $RM -f $TMPDIR/j.* > /dev/null
115 log_assert "The largest pool can be created and a dataset in that" \
116 "pool can be created and mounted."
118 # Set trigger. When the test case exit, cleanup is executed.
121 # -----------------------------------------------------------------------
122 # volume sizes with unit designations.
124 # Note: specifying the number '1' as size will not give the correct
125 # units for 'df'. It must be greater than one.
126 # -----------------------------------------------------------------------
129 for volsize in $VOLSIZES; do
130 log_note "Create a pool which will contain a volume device"
131 create_pool $TESTPOOL2 "$DISKS"
133 log_note "Create a volume device of desired sizes: $volsize"
134 str=$($ZFS create -sV $volsize $TESTPOOL2/$TESTVOL 2>&1)
136 if (( ret != 0 )); then
137 if [[ $($ISAINFO -b) == 32 && \
138 $str == *${VOL_LIMIT_KEYWORD1}* || \
139 $str == *${VOL_LIMIT_KEYWORD2}* || \
140 $str == *${VOL_LIMIT_KEYWORD3}* ]]
143 "Max volume size is 1TB on 32-bit systems."
145 log_fail "$ZFS create -sV $volsize $TESTPOOL2/$TESTVOL"
149 log_note "Create the largest pool allowed using the volume vdev"
150 create_pool $TESTPOOL "$VOL_PATH"
152 log_note "Create a zfs file system in the largest pool"
153 log_must $ZFS create $TESTPOOL/$TESTFS
155 log_note "Parse the execution result"
156 parse_expected_output $volsize
158 log_note "unmount this zfs file system $TESTPOOL/$TESTFS"
159 log_must $ZFS unmount $TESTPOOL/$TESTFS
161 log_note "Destroy zfs, volume & zpool"
162 log_must $ZFS destroy $TESTPOOL/$TESTFS
163 destroy_pool $TESTPOOL
164 log_must $ZFS destroy $TESTPOOL2/$TESTVOL
165 destroy_pool $TESTPOOL2
168 log_pass "Dateset can be created, mounted & destroy in largest pool succeeded."