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 2008 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
28 # Copyright (c) 2012 by Delphix. All rights reserved.
31 . $STF_SUITE/include/libtest.shlib
33 export DISKSARRAY=$DISKS
34 export DISK_ARRAY_NUM=$($ECHO ${DISKS} | $NAWK '{print NF}')
35 typeset -a disk_array=($(find_disks $DISKS))
36 case "${#disk_array[*]}" in
39 # on stf_configure, disk_freelist returns empty.
44 # We need to repartition the single disk to two slices.
47 ZFS_DISK1=${disk_array[0]}
48 ZFS_DISK2=${disk_array[0]}
49 if is_mpath_device $ZFS_DISK1; then
50 export DEV_DSKDIR=$DEV_MPATHDIR
52 export DEV_DSKDIR=$DEV_RDSKDIR
54 if ( is_mpath_device $ZFS_DISK1 ) && [[ -z $($ECHO $ZFS_DISK1 | awk 'substr($1,18,1)\
55 ~ /^[[:digit:]]+$/') ]] || ( is_real_device $ZFS_DISK1 ); then
56 ZFSSIDE_DISK1=${ZFS_DISK1}1
57 ZFSSIDE_DISK2=${ZFS_DISK2}2
58 elif ( is_mpath_device $ZFS_DISK1 || is_loop_device $ZFS_DISK1 ); then
59 ZFSSIDE_DISK1=${ZFS_DISK1}p1
60 ZFSSIDE_DISK2=${ZFS_DISK2}p2
62 log_fail "$ZFS_DISK1 not supported for partitioning."
65 export DEV_DSKDIR="/dev"
67 ZFS_DISK1=${disk_array[0]}
68 ZFSSIDE_DISK1=${ZFS_DISK1}s0
69 ZFS_DISK2=${disk_array[0]}
70 ZFSSIDE_DISK2=${ZFS_DISK2}s1
74 # We need to repartition the single disk to two slices.
77 ZFS_DISK1=${disk_array[0]}
78 if is_mpath_device $ZFS_DISK1; then
79 export DEV_DSKDIR=$DEV_MPATHDIR
81 export DEV_DSKDIR=$DEV_RDSKDIR
83 if ( is_mpath_device $ZFS_DISK1 ) && [[ -z $($ECHO $ZFS_DISK1 | awk 'substr($1,18,1)\
84 ~ /^[[:digit:]]+$/') ]] || ( is_real_device $ZFS_DISK1 ); then
85 ZFSSIDE_DISK1=${ZFS_DISK1}1
86 elif ( is_mpath_device $ZFS_DISK1 || is_loop_device $ZFS_DISK1 ); then
87 ZFSSIDE_DISK1=${ZFS_DISK1}p1
89 log_fail "$ZFS_DISK1 not supported for partitioning."
91 ZFS_DISK2=${disk_array[1]}
92 if ( is_mpath_device $ZFS_DISK2 ) && [[ -z $($ECHO $ZFS_DISK2 | awk 'substr($1,18,1)\
93 ~ /^[[:digit:]]+$/') ]] || ( is_real_device $ZFS_DISK2 ); then
94 ZFSSIDE_DISK2=${ZFS_DISK2}1
95 elif ( is_mpath_device $ZFS_DISK2 || is_loop_device $ZFS_DISK2 ); then
96 ZFSSIDE_DISK2=${ZFS_DISK2}p1
98 log_fail "$ZFS_DISK2 not supported for partitioning."
101 export DEV_DSKDIR="/dev"
103 ZFS_DISK1=${disk_array[0]}
104 ZFSSIDE_DISK1=${ZFS_DISK1}s0
105 ZFS_DISK2=${disk_array[1]}
106 ZFSSIDE_DISK2=${ZFS_DISK2}s0
111 export DISK_COUNT ZFS_DISK1 ZFSSIDE_DISK1 ZFS_DISK2 ZFSSIDE_DISK2
115 export SLICE_SIZE=128m
118 export DEVICE_DIR=$TEST_BASE_DIR/dev_import-test
119 export BACKUP_DEVICE_DIR=$TEST_BASE_DIR/bakdev_import-test
120 export DEVICE_FILE=disk
121 export DEVICE_ARCHIVE=archive_import-test
122 export MYTESTFILE=$STF_SUITE/include/libtest.shlib
125 while (( num < $GROUP_NUM )); do
126 DEVICE_FILES="$DEVICE_FILES ${DEVICE_DIR}/${DEVICE_FILE}$num"
131 export VDEV0=$DEVICE_DIR/${DEVICE_FILE}0
132 export VDEV1=$DEVICE_DIR/${DEVICE_FILE}1
133 export VDEV2=$DEVICE_DIR/${DEVICE_FILE}2
134 export VDEV3=$DEVICE_DIR/${DEVICE_FILE}3
135 export VDEV4=$DEVICE_DIR/${DEVICE_FILE}4
137 export ALTER_ROOT=/alter_import-test