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 2009 Sun Microsystems, Inc.  All rights reserved.
27# Use is subject to license terms.
28#
29# ident	"@(#)zpool_upgrade.cfg	1.7	09/06/22 SMI"
30#
31
32. $STF_SUITE/tests/cli_root/cli.cfg
33. $STF_SUITE/include/libtest.kshlib
34
35export STF_TIMEOUT=1800
36
37# We need to determine which version of ZFS we're running on, so as to
38# work out which types of pool we should be able to upgrade on this
39# system.
40export ZPOOL_VERSION=$(get_zpool_version)
41
42
43# The following variable names describe files, stored as gzip compressed files
44# in the test directory which can be used to construct a pool of a given
45# version. The variable names are important, in that the construction
46# ZPOOL_VERSION_$var_FILES describes the files the pool is made from, and
47# ZPOOL_VERSION_$var_NAME describes the pool name.
48
49# Version 1 pools
50export ZPOOL_VERSION_1_FILES="zfs-pool-v1.dat"
51export ZPOOL_VERSION_1_NAME="v1-pool"
52# v1 stripe
53export ZPOOL_VERSION_1stripe_FILES="zfs-pool-v1stripe1.dat \
54zfs-pool-v1stripe2.dat  zfs-pool-v1stripe3.dat"
55export ZPOOL_VERSION_1stripe_NAME="pool-v1stripe"
56# v1 raidz
57export ZPOOL_VERSION_1raidz_FILES="zfs-pool-v1raidz1.dat zfs-pool-v1raidz2.dat \
58zfs-pool-v1raidz3.dat"
59export ZPOOL_VERSION_1raidz_NAME="pool-v1raidz"
60# v1 mirror
61export ZPOOL_VERSION_1mirror_FILES="zfs-pool-v1mirror1.dat \
62zfs-pool-v1mirror2.dat zfs-pool-v1mirror3.dat"
63export ZPOOL_VERSION_1mirror_NAME="pool-v1mirror"
64
65
66# Version 2 pools
67export ZPOOL_VERSION_2_FILES="zfs-pool-v2.dat"
68export ZPOOL_VERSION_2_NAME="v2-pool"
69# v2 stripe
70export ZPOOL_VERSION_2stripe_FILES="zfs-pool-v2stripe1.dat \
71zfs-pool-v2stripe2.dat  zfs-pool-v2stripe3.dat"
72export ZPOOL_VERSION_2stripe_NAME="pool-v2stripe"
73# v2 raidz
74export ZPOOL_VERSION_2raidz_FILES="zfs-pool-v2raidz1.dat zfs-pool-v2raidz2.dat \
75zfs-pool-v2raidz3.dat"
76export ZPOOL_VERSION_2raidz_NAME="pool-v2raidz"
77# v2 mirror
78export ZPOOL_VERSION_2mirror_FILES="zfs-pool-v2mirror1.dat \
79zfs-pool-v2mirror2.dat zfs-pool-v2mirror3.dat"
80export ZPOOL_VERSION_2mirror_NAME="pool-v2mirror"
81
82
83# This is a v3 pool
84export ZPOOL_VERSION_3_FILES="zfs-pool-v3.dat"
85export ZPOOL_VERSION_3_NAME="v3-pool"
86# v3 stripe
87export ZPOOL_VERSION_3stripe_FILES="zfs-pool-v3stripe1.dat \
88zfs-pool-v3stripe2.dat  zfs-pool-v3stripe3.dat"
89export ZPOOL_VERSION_3stripe_NAME="pool-v3stripe"
90# v3 raidz
91export ZPOOL_VERSION_3raidz_FILES="zfs-pool-v3raidz1.dat zfs-pool-v3raidz2.dat \
92zfs-pool-v3raidz3.dat"
93export ZPOOL_VERSION_3raidz_NAME="pool-v3raidz"
94# v3 mirror
95export ZPOOL_VERSION_3mirror_FILES="zfs-pool-v3mirror1.dat \
96zfs-pool-v3mirror2.dat zfs-pool-v3mirror3.dat"
97export ZPOOL_VERSION_3mirror_NAME="pool-v3mirror"
98# v3 raidz2
99export ZPOOL_VERSION_3dblraidz_FILES="zfs-pool-v3raidz21.dat \
100zfs-pool-v3raidz22.dat zfs-pool-v3raidz23.dat"
101export ZPOOL_VERSION_3dblraidz_NAME="pool-v3raidz2"
102# v3 hotspares
103export ZPOOL_VERSION_3hotspare_FILES="zfs-pool-v3hotspare1.dat \
104zfs-pool-v3hotspare2.dat zfs-pool-v3hotspare3.dat"
105export ZPOOL_VERSION_3hotspare_NAME="pool-v3hotspare"
106
107# v4 pool
108export ZPOOL_VERSION_4_FILES="zfs-pool-v4.dat"
109export ZPOOL_VERSION_4_NAME="v4-pool"
110
111# v5 pool
112export ZPOOL_VERSION_5_FILES="zfs-pool-v5.dat"
113export ZPOOL_VERSION_5_NAME="v5-pool"
114
115# v6 pool
116export ZPOOL_VERSION_6_FILES="zfs-pool-v6.dat"
117export ZPOOL_VERSION_6_NAME="v6-pool"
118
119# v7 pool
120export ZPOOL_VERSION_7_FILES="zfs-pool-v7.dat"
121export ZPOOL_VERSION_7_NAME="v7-pool"
122
123# v8 pool
124export ZPOOL_VERSION_8_FILES="zfs-pool-v8.dat"
125export ZPOOL_VERSION_8_NAME="v8-pool"
126
127# v9 pool
128export ZPOOL_VERSION_9_FILES="zfs-pool-v9.dat"
129export ZPOOL_VERSION_9_NAME="v9-pool"
130
131# v10 pool
132export ZPOOL_VERSION_10_FILES="zfs-pool-v10.dat"
133export ZPOOL_VERSION_10_NAME="v10-pool"
134
135# v11 pool
136export ZPOOL_VERSION_11_FILES="zfs-pool-v11.dat"
137export ZPOOL_VERSION_11_NAME="v11-pool"
138
139# v12 pool
140export ZPOOL_VERSION_12_FILES="zfs-pool-v12.dat"
141export ZPOOL_VERSION_12_NAME="v12-pool"
142
143# v13 pool
144export ZPOOL_VERSION_13_FILES="zfs-pool-v13.dat"
145export ZPOOL_VERSION_13_NAME="v13-pool"
146
147# v14 pool
148export ZPOOL_VERSION_14_FILES="zfs-pool-v14.dat"
149export ZPOOL_VERSION_14_NAME="v14-pool"
150
151# v15 pool
152export ZPOOL_VERSION_15_FILES="zfs-pool-v15.dat"
153export ZPOOL_VERSION_15_NAME="v15-pool"
154
155# v28 pool
156export ZPOOL_VERSION_28_FILES="zfs-pool-v28.dat"
157export ZPOOL_VERSION_28_NAME="v28-pool"
158
159# v5000 pool
160export ZPOOL_VERSION_5000_FILES="zfs-pool-v5000.dat"
161export ZPOOL_VERSION_5000_NAME="v5000-pool"
162
163# This pool is a v2 pool, with device problems on one side of the mirror
164# so that the pool appears as DEGRADED
165export ZPOOL_VERSION_2brokenmirror_FILES="zfs-broken-mirror1.dat \
166zfs-broken-mirror2.dat"
167export ZPOOL_VERSION_2brokenmirror_NAME="zfs-broken-mirror"
168
169
170# This pool is a v999 pool (an unknown version) which can be used to check
171# whether upgrade, import or other tests that should fail against unknown
172# pool versions should fail. It should not be listed in the CONFIGS
173# variable below, as these are pool versions that can be imported and upgraded
174export ZPOOL_VERSION_9999_FILES="zfs-pool-v999.dat"
175export ZPOOL_VERSION_9999_NAME="v999-pool"
176
177
178# This statement builds up a list of configurations we should be able to
179# upgrade, for each pool version. Once we've built this variable, we'll
180# call the functions above for each value.
181case $ZPOOL_VERSION in
1821)
183	# we should be able to upgrade pools of version 1
184	CONFIGS="1 1stripe 1raidz 1mirror"
185	;;
186
1872)
188	# we should be able to upgrade pools of version 1 & 2
189	CONFIGS="1 1stripe 1raidz 1mirror \
190	2 2stripe 2raidz 2mirror 2brokenmirror"
191	;;
1923)
193	# we should be able to upgrade pools of version 1, 2 & 3
194	CONFIGS="1 1stripe 1raidz 1mirror \
195	2 2stripe 2raidz 2mirror 2brokenmirror \
196	3 3stripe 3raidz 3mirror 3dblraidz 3hotspare"
197	;;
1984)
199	# we should be able to upgrade pools of version 1, 2, 3 & 4
200	CONFIGS="1 1stripe 1raidz 1mirror \
201	2 2stripe 2raidz 2mirror 2brokenmirror \
202	3 3stripe 3raidz 3mirror 3dblraidz 3hotspare 4"
203	;;
2045)
205	# we should be able to upgrade pools up to version 5
206	CONFIGS="1 1stripe 1raidz 1mirror \
207	2 2stripe 2raidz 2mirror 2brokenmirror \
208	3 3stripe 3raidz 3mirror 3dblraidz 3hotspare 4 5"
209	;;
2106)
211	# we should be able to upgrade pools up to version 6
212	CONFIGS="1 1stripe 1raidz 1mirror \
213	2 2stripe 2raidz 2mirror 2brokenmirror \
214	3 3stripe 3raidz 3mirror 3dblraidz 3hotspare 4 5 6"
215	;;
2167)
217	# we should be able to upgrade pools up to version 7
218	CONFIGS="1 1stripe 1raidz 1mirror \
219	2 2stripe 2raidz 2mirror 2brokenmirror \
220	3 3stripe 3raidz 3mirror 3dblraidz 3hotspare 4 5 6 7"
221	;;
2228)
223	# we should be able to upgrade pools up to version 8
224	CONFIGS="1 1stripe 1raidz 1mirror \
225	2 2stripe 2raidz 2mirror 2brokenmirror \
226	3 3stripe 3raidz 3mirror 3dblraidz 3hotspare 4 5 6 7 8"
227	;;
2289)
229	# we should be able to upgrade pools up to version 9
230	CONFIGS="1 1stripe 1raidz 1mirror \
231	2 2stripe 2raidz 2mirror 2brokenmirror \
232	3 3stripe 3raidz 3mirror 3dblraidz 3hotspare 4 5 6 7 8 9"
233	;;
23410)
235	# we should be able to upgrade pools up to version 10
236	CONFIGS="1 1stripe 1raidz 1mirror \
237	2 2stripe 2raidz 2mirror 2brokenmirror \
238	3 3stripe 3raidz 3mirror 3dblraidz 3hotspare 4 5 6 7 8 9 10"
239	;;
24011)
241	# we should be able to upgrade pools up to version 11
242	CONFIGS="1 1stripe 1raidz 1mirror \
243	2 2stripe 2raidz 2mirror 2brokenmirror \
244	3 3stripe 3raidz 3mirror 3dblraidz 3hotspare 4 5 6 7 8 9 10 11"
245	;;
24612)
247	# we should be able to upgrade pools up to version 12
248	CONFIGS="1 1stripe 1raidz 1mirror \
249	2 2stripe 2raidz 2mirror 2brokenmirror \
250	3 3stripe 3raidz 3mirror 3dblraidz 3hotspare 4 5 6 7 8 9 10 11 12"
251	;;
25213)
253	# we should be able to upgrade pools up to version 13
254	CONFIGS="1 1stripe 1raidz 1mirror \
255	2 2stripe 2raidz 2mirror 2brokenmirror \
256	3 3stripe 3raidz 3mirror 3dblraidz 3hotspare 4 5 6 7 8 9 10 11 12 13"
257	;;
25814)
259	# we should be able to upgrade pools up to version 14
260	CONFIGS="1 1stripe 1raidz 1mirror \
261	2 2stripe 2raidz 2mirror 2brokenmirror \
262	3 3stripe 3raidz 3mirror 3dblraidz 3hotspare 4 5 6 7 8 9 10 11 12 13 14"
263	;;
26415)
265	# we should be able to upgrade pools up to version 15
266	CONFIGS="1 1stripe 1raidz 1mirror \
267	2 2stripe 2raidz 2mirror 2brokenmirror \
268	3 3stripe 3raidz 3mirror 3dblraidz 3hotspare 4 5 6 7 8 9 10 11 12 13 14 15"
269	;;
27028)
271	# we should be able to upgrade pools up to version 15
272	CONFIGS="1 1stripe 1raidz 1mirror \
273	2 2stripe 2raidz 2mirror 2brokenmirror \
274	3 3stripe 3raidz 3mirror 3dblraidz 3hotspare 4 5 6 7 8 9 10 11 12 13 14 15 28"
275	;;
2765000)
277	# we should be able to upgrade pools up to version 15
278	CONFIGS="1 1stripe 1raidz 1mirror \
279	2 2stripe 2raidz 2mirror 2brokenmirror \
280	3 3stripe 3raidz 3mirror 3dblraidz 3hotspare 4 5 6 7 8 9 10 11 12 13 14 15 28 5000"
281	;;
282*)
283	# we should be able to upgrade pools up to version 15
284	# but we should also log a note about the unknown pool version
285	CONFIGS="1 1stripe 1raidz 1mirror \
286	2 2stripe 2raidz 2mirror 2brokenmirror \
287	3 3stripe 3raidz 3mirror 3dblraidz 3hotspare 4 5 6 7 8 9 10 11 12 13 14 15"
288
289	log_note "Unknown ZFS version $ZPOOL_VERSION encountered:\
290		Test suite may need updating."
291	;;
292esac
293export CONFIGS
294