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