1# vim: filetype=sh
2#
3# CDDL HEADER START
4#
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.
8#
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.
13#
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]
19#
20# CDDL HEADER END
21#
22
23# $FreeBSD$
24
25
26# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
27# Use is subject to license terms.
28#
29# ident	"@(#)zpool_import.cfg	1.6	08/11/03 SMI"
30#
31
32. $STF_SUITE/tests/cli_root/cli.cfg
33. $STF_SUITE/include/libtest.kshlib
34
35set -A disk_array $(find_disks $DISKS)
36case "${#disk_array[*]}" in
370)
38	#
39	# on stf_configure, disk_freelist returns empty.
40	#
41	DISK_COUNT=0
42	;;
431)
44	# We need to repartition the single disk to two slices.
45	DISK_COUNT=1
46	ZFS_DISK1=${disk_array[0]}
47	ZFSSIDE_DISK1=${ZFS_DISK1}p1
48	ZFS_DISK2=${disk_array[0]}
49	ZFSSIDE_DISK2=${ZFS_DISK2}p2
50	;;
51*)
52	# We don't need to repartition anything
53	DISK_COUNT=2
54	ZFS_DISK1=${disk_array[0]}
55	ZFSSIDE_DISK1=${ZFS_DISK1}
56	ZFS_DISK2=${disk_array[1]}
57	ZFSSIDE_DISK2=${ZFS_DISK2}
58	;;
59esac
60
61export DISK_COUNT ZFS_DISK1 ZFSSIDE_DISK1 ZFS_DISK2 ZFSSIDE_DISK2
62
63export FS_SIZE=2gb
64export FILE_SIZE=64m
65export PART_SIZE=128m
66export MAX_NUM=5
67export GROUP_NUM=3
68export DEVICE_DIR=${TMPDIR}/dev${TESTCASE_ID}
69export BACKUP_DEVICE_DIR=/bakdev${TESTCASE_ID}
70export DEVICE_FILE=disk
71export DEVICE_ARCHIVE=${TMPDIR}/archive${TESTCASE_ID}.tar
72# MYTESTFILE can be any file that exists and we have r access to
73export MYTESTFILE=$STF_SUITE/include/default.cfg
74
75# NB: It's easier just to repeat the expansion patterns than to reuse.
76for (( num=0 ; $num < $GROUP_NUM ; num += 1 )); do
77	eval export VDEV\${num}F="${DEVICE_FILE}${num}"
78	eval export VDEV\${num}="${DEVICE_DIR}/${DEVICE_FILE}${num}"
79	DEVICE_FILES="$DEVICE_FILES ${DEVICE_DIR}/${DEVICE_FILE}${num}"
80done
81export DEVICE_FILES
82for (( num = GROUP_NUM ; $num < $MAX_NUM ; num += 1 )); do
83	eval export VDEV\${num}F="${DEVICE_FILE}${num}"
84	eval export VDEV\${num}="${DEVICE_DIR}/${DEVICE_FILE}${num}"
85done
86
87export ALTER_ROOT=/alter${TESTCASE_ID}
88export STF_TIMEOUT=2400
89
90export ZPOOL_VERSION=$(get_zpool_version)
91
92# Version 1 pools
93export ZPOOL_VERSION_1_FILES="zfs-pool-v1.dat"
94export ZPOOL_VERSION_1_NAME="v1-pool"
95
96# Version 2 pools
97export ZPOOL_VERSION_2_FILES="zfs-pool-v2.dat"
98export ZPOOL_VERSION_2_NAME="v2-pool"
99
100# This is a v3 pool
101export ZPOOL_VERSION_3_FILES="zfs-pool-v3.dat"
102export ZPOOL_VERSION_3_NAME="v3-pool"
103
104# This is a v6 pool
105export ZPOOL_VERSION_6_FILES="zfs-pool-v6.dat"
106export ZPOOL_VERSION_6_NAME="v6-pool"
107
108# This is a v7 pool
109export ZPOOL_VERSION_7_FILES="zfs-pool-v7.dat"
110export ZPOOL_VERSION_7_NAME="v7-pool"
111
112# This is a v8 pool
113export ZPOOL_VERSION_8_FILES="zfs-pool-v8.dat"
114export ZPOOL_VERSION_8_NAME="v8-pool"
115
116# This statement builds up a list of configurations we should be able to
117# upgrade, for each pool version. Once we've built this variable, we'll
118# call the functions above for each value.
119case $ZPOOL_VERSION in
1206)
121	CONFIGS="6"
122	;;
1237)
124	CONFIGS="6 7"
125	;;
1268)
127	CONFIGS="6 7 8"
128	;;
129*)
130	# we should be able to upgrade pools of version 1, 2 & 3
131	# but we should also log a note about the unknown pool version
132	CONFIGS="6 7 8"
133	;;
134esac
135export CONFIGS
136