1# 2# CDDL HEADER START 3# 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. 7# 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. 12# 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] 18# 19# CDDL HEADER END 20# 21 22# 23# Copyright 2007 Sun Microsystems, Inc. All rights reserved. 24# Use is subject to license terms. 25# 26 27# 28# Copyright (c) 2012, 2016 by Delphix. All rights reserved. 29# 30 31. $STF_SUITE/include/libtest.shlib 32. $STF_SUITE/tests/functional/cli_root/zpool_add/zpool_add.cfg 33 34# 35# Find the storage device in /etc/vfstab 36# 37function find_vfstab_dev 38{ 39 typeset vfstab="/etc/vfstab" 40 typeset tmpfile="/tmp/vfstab.tmp" 41 typeset vfstabdev 42 typeset vfstabdevs="" 43 typeset line 44 45 cat $vfstab | grep "^/dev/dsk" >$tmpfile 46 while read -r line 47 do 48 vfstabdev=`echo "$line" | awk '{print $1}'` 49 vfstabdev=${vfstabdev%%:} 50 vfstabdevs="$vfstabdev $vfstabdevs" 51 done <$tmpfile 52 53 rm -f $tmpfile 54 echo $vfstabdevs 55} 56 57# 58# Find the storage device in /etc/mnttab 59# 60function find_mnttab_dev 61{ 62 typeset mnttab="/etc/mnttab" 63 typeset tmpfile="/tmp/mnttab.tmp" 64 typeset mnttabdev 65 typeset mnttabdevs="" 66 typeset line 67 68 cat $mnttab | grep "^/dev/dsk" >$tmpfile 69 while read -r line 70 do 71 mnttabdev=`echo "$line" | awk '{print $1}'` 72 mnttabdev=${mnttabdev%%:} 73 mnttabdevs="$mnttabdev $mnttabdevs" 74 done <$tmpfile 75 76 rm -f $tmpfile 77 echo $mnttabdevs 78} 79 80# 81# Save the systme current dump device configuration 82# 83function save_dump_dev 84{ 85 86 typeset dumpdev 87 typeset fnd="Dump device" 88 89 dumpdev=`dumpadm | grep "$fnd" | cut -f2 -d : | \ 90 awk '{print $1}'` 91 echo $dumpdev 92} 93 94# 95# Common cleanup routine for partitions used in testing 96# 97function partition_cleanup 98{ 99 100 if [[ -n $DISK ]]; then 101 partition_disk $SIZE $DISK 7 102 else 103 typeset disk="" 104 for disk in $DISK0 $DISK1; do 105 partition_disk $SIZE $disk 7 106 done 107 fi 108 109} 110