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.
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.
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]
24 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
28 .
$STF_SUITE/include
/libtest.shlib
29 .
$STF_SUITE/tests
/functional
/cli_root
/zfs_upgrade
/zfs_upgrade.kshlib
33 # Executing 'zfs upgrade -r [-V version] filesystem' command succeeds,
34 # it upgrade filesystem recursively to specific or current version.
37 # 1. Prepare a set of datasets which contain old-version and current version.
38 # 2. Execute 'zfs upgrade -r [-V version] filesystem', verify return 0,
39 # 3. Verify the filesystem be updated recursively as expected.
42 verify_runnable
"both"
46 if datasetexists
$rootfs ; then
47 log_must
$ZFS destroy
-Rf $rootfs
49 log_must
$ZFS create
$rootfs
52 function setup_datasets
55 for version
in $ZFS_ALL_VERSIONS ; do
57 eval verfs
=\
$ZFS_VERSION_$version
58 typeset current_fs
=$rootfs/$verfs
59 typeset current_snap
=${current_fs}@snap
60 typeset current_clone
=$rootfs/clone
$verfs
61 log_must
$ZFS create
-o version
=${version} ${current_fs}
62 log_must
$ZFS snapshot
${current_snap}
63 log_must
$ZFS clone
${current_snap} ${current_clone}
65 for subversion
in $ZFS_ALL_VERSIONS ; do
67 eval subverfs
=\
$ZFS_VERSION_$subversion
68 log_must
$ZFS create
-o version
=${subversion} \
69 ${current_fs}/$subverfs
71 datasets
="$datasets ${current_fs}"
75 log_assert
"Executing 'zfs upgrade -r [-V version] filesystem' command succeeds."
78 rootfs
=$TESTPOOL/$TESTFS
83 for newv
in "" "current" $ZFS_VERSION; do
85 for topfs
in $datasets ; do
86 if [[ -n $newv ]]; then
88 if [[ $newv == current
]]; then
95 log_must
eval '$ZFS upgrade -r $opt $topfs > /dev/null 2>&1'
97 for fs
in $
($ZFS list
-rH -t filesystem
-o name
$topfs) ; do
98 log_must check_fs_version
$fs $newv
104 log_pass
"Executing 'zfs upgrade -r [-V version] filesystem' command succeeds."