4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
23 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
28 # Copyright (c) 2012, 2016 by Delphix. All rights reserved.
31 . $STF_SUITE/include/libtest.shlib
32 . $STF_SUITE/tests/functional/cli_root/zpool_create/zpool_create.cfg
35 # Given a pool vdevs list, create the pool,verify the created pool,
36 # and destroy the pool
38 # $2, pool type, mirror, raidz, or none
41 function create_pool_test
46 eval "typeset -a diskarray=($3)"
48 for vdevs in "${diskarray[@]}";do
49 create_pool $pool $keywd $vdevs
50 log_must poolexists $pool
56 # Create a ufs file system and make a file within the file
57 # system for storage pool vdev
60 # $3, disk name to create ufs file system
62 function create_blockfile
67 typeset dir=`dirname $file`
69 if [[ -d $dir ]]; then
72 log_must umount -f $dir
74 log_must mkdir -p $dir
77 echo "y" | newfs /dev/rdsk/$disk >/dev/null 2>&1
79 log_fail "Create ufs file system fail."
81 log_must mount /dev/dsk/$disk $dir
82 log_must mkfile $size $file
86 # Umount the ufs filesystem and remove the mountpoint
89 function clean_blockfile
94 if [[ -d $dir ]]; then
95 if ismounted $dir ufs; then
96 typeset dev=$(df -lhF ufs | grep "$dir" | \
98 log_must umount -f $dir
99 create_pool ${TESTPOOL}.tmp $dev
100 destroy_pool ${TESTPOOL}.tmp
108 # Find the storage device in /etc/vfstab
110 function find_vfstab_dev
112 typeset vfstab="/etc/vfstab"
113 typeset tmpfile="/tmp/vfstab.tmp"
115 typeset vfstabdevs=""
118 cat $vfstab | grep "^/dev/dsk" >$tmpfile
121 vfstabdev=`echo "$line" | awk '{print $1}'`
122 vfstabdev=${vfstabdev%%:}
123 vfstabdevs="$vfstabdev $vfstabdevs"
131 # Save the systme current dump device configuration
133 function save_dump_dev
137 typeset fnd="Dump device"
139 dumpdev=`dumpadm | grep "$fnd" | cut -f2 -d : | \