zfs_upgrade.kshlib revision d583b39bfb4e2571d3e41097c5c357ffe353ad45
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# CDDL HEADER START
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# The contents of this file are subject to the terms of the
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# Common Development and Distribution License (the "License").
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# You may not use this file except in compliance with the License.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# See the License for the specific language governing permissions
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# and limitations under the License.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# When distributing Covered Code, include this CDDL HEADER in each
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# If applicable, add the following below this CDDL HEADER, with the
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# fields enclosed by brackets "[]" replaced with your own identifying
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# information: Portions Copyright [yyyy] [name of copyright owner]
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# CDDL HEADER END
bd0f52d78d701efcad2c460df61b45677d041c35jhaslam# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# Use is subject to license terms.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# For zfs create.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# For zfs upgrade
9512fe850e98fdd448c638ca63fdd92a8a510255ahl typeset pool=${rootfs%%/*}
9512fe850e98fdd448c638ca63fdd92a8a510255ahl typeset -i m
9512fe850e98fdd448c638ca63fdd92a8a510255ahl if (( spa_version != 0 )) && (( vp < spa_version )); then
9512fe850e98fdd448c638ca63fdd92a8a510255ahl log_mustnot $ZFS create -o version=${version} ${current_fs}
9512fe850e98fdd448c638ca63fdd92a8a510255ahl log_must $ZFS create -o version=${version} ${current_fs}
log_mustnot $ZFS create -o \
version=${subversion} ${current_fs}/$subverfs
version=${subversion} ${current_fs}/$subverfs
typeset rootfs=$1
if datasetexists $rootfs ; then
if datasetnonexists $rootfs ; then
typeset rootfs=$1
typeset -i spa_version
typeset -i zpl_version
typeset newv
typeset -i df_ret
df_ret=$?
if [[ -n $newv ]]; then
typeset fs=$1
typeset -i version=${2:-$ZFS_VERSION}
if [[ -z $fs ]]; then