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