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 https://opensource.org/licenses/CDDL-1.0. 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 2008 Sun Microsystems, Inc. All rights reserved. 24# Use is subject to license terms. 25# 26 27# 28# Copyright (c) 2013, 2016 by Delphix. All rights reserved. 29# 30 31. $STF_SUITE/include/libtest.shlib 32 33export DISKSARRAY=$DISKS 34export DISK_ARRAY_NUM=$(echo ${DISKS} | awk '{print NF}') 35set -A disk_array $(find_disks $DISKS) 36case "${#disk_array[*]}" in 370) 38 DISK_COUNT=0 39 ;; 401) 41 # We need to repartition the single disk to two slices. 42 DISK_COUNT=1 43 ZFS_DISK=${disk_array[0]} 44 SINGLE_DISK=$ZFS_DISK 45 NONZFS_DISK=$ZFS_DISK 46 if is_linux; then 47 if is_mpath_device $ZFS_DISK; then 48 export DEV_DSKDIR=$DEV_MPATHDIR 49 else 50 export DEV_DSKDIR=$DEV_RDSKDIR 51 fi 52 if ( is_mpath_device $ZFS_DISK ) && [[ -z $(echo $ZFS_DISK | awk 'substr($1,18,1)\ 53 ~ /^[[:digit:]]+$/') ]] || ( is_real_device $ZFS_DISK ); then 54 ZFSSIDE_DISK=${SINGLE_DISK}1 55 NONZFSSIDE_DISK=${SINGLE_DISK}2 56 elif ( is_mpath_device $ZFS_DISK || is_loop_device $ZFS_DISK ); then 57 ZFSSIDE_DISK=${SINGLE_DISK}p1 58 NONZFSSIDE_DISK=${SINGLE_DISK}p2 59 else 60 log_fail "$ZFS_DISK not supported for partitioning." 61 fi 62 else 63 ZFSSIDE_DISK=${SINGLE_DISK}s0 64 NONZFSSIDE_DISK=${SINGLE_DISK}s1 65 fi 66 ;; 67*) 68 # In this case there are at least enough disks to use. 69 DISK_COUNT=2 70 ZFS_DISK=${disk_array[0]} 71 NONZFS_DISK=${disk_array[1]} 72 if is_linux; then 73 if is_mpath_device $ZFS_DISK; then 74 export DEV_DSKDIR=$DEV_MPATHDIR 75 else 76 export DEV_DSKDIR=$DEV_RDSKDIR 77 fi 78 if ( is_mpath_device $ZFS_DISK ) && [[ -z $(echo $ZFS_DISK | awk 'substr($1,18,1)\ 79 ~ /^[[:digit:]]+$/') ]] || ( is_real_device $ZFS_DISK ); then 80 ZFSSIDE_DISK=${ZFS_DISK}1 81 elif ( is_mpath_device $ZFS_DISK || is_loop_device $ZFS_DISK ); then 82 ZFSSIDE_DISK=${ZFS_DISK}p1 83 else 84 log_fail "$ZFS_DISK not supported for partitioning." 85 fi 86 if ( is_mpath_device $NONZFS_DISK ) && [[ -z $(echo $NONZFS_DISK | awk 'substr($1,18,1)\ 87 ~ /^[[:digit:]]+$/') ]] || ( is_real_device $NONZFS_DISK ); then 88 NONZFSSIDE_DISK=${NONZFS_DISK}1 89 elif ( is_mpath_device $NONZFS_DISK || is_loop_device $NONZFS_DISK ); then 90 NONZFSSIDE_DISK=${NONZFS_DISK}p1 91 else 92 log_fail "$NONZFS_DISK not supported for partitioning." 93 fi 94 else 95 ZFSSIDE_DISK=${ZFS_DISK}s0 96 NONZFSSIDE_DISK=${NONZFS_DISK}s0 97 fi 98 ;; 99esac 100 101export DISK_COUNT ZFS_DISK NONZFS_DISK SINGLE_DISK ZFSSIDE_DISK NONZFSSIDE_DISK 102 103export TESTFILE=/etc/passwd 104export NONZFS_TESTDIR=$TESTDIR/nonzfstestdir 105read -r SUMA SUMB _ < <(cksum $TESTFILE) 106export SUMA SUMB 107export FS_SIZE=1g 108export BNAME=`basename $TESTFILE` 109export DNAME=`dirname $TESTFILE` 110