zfs_promote_003_pos.ksh revision 1d32ba663e202c24a5a1f2e5aef83fffb447cb7f
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
#
# DESCRIPTION:
# 'zfs promote' can deal with multi-point snapshots.
#
# STRATEGY:
# 1. Create multiple snapshots and a clone to a middle point snapshot
# 2. Promote the clone filesystem
# 3. Verify the origin filesystem and promoted filesystem include
# correct datasets seperated by the clone point.
#
verify_runnable "both"
function cleanup
{
if snapexists ${csnap[2]}; then
fi
typeset ds
typeset data
snapexists $ds && \
done
done
}
log_assert "'zfs promote' can deal with multi-point snapshots."
# Define some arrays here to use loop to reduce code amount
# Array which stores the origin snapshots created in the origin filesystem
set -A snap "${fs}@$TESTSNAP" "${fs}@$TESTSNAP1" "${fs}@$TESTSNAP2" "${fs}@$TESTSNAP3"
# Array which stores the snapshots existing in the clone after promote operation
set -A csnap "${clone}@$TESTSNAP" "${clone}@$TESTSNAP1" "${clone}@$TESTSNAP2" \
"${clone}@$TESTSNAP3"
# The data will inject into the origin filesystem
set -A file "$TESTDIR/$TESTFILE0" "$TESTDIR/$TESTFILE1" "$TESTDIR/$TESTFILE2" \
# The data which will exist in the snapshot after creation of snapshot
set -A snapfile "$snapdir/$TESTSNAP/$TESTFILE0" "$snapdir/$TESTSNAP1/$TESTFILE1" \
# The data which will exist in the snapshot of clone filesystem after promote
set -A csnapfile "${csnapdir}/$TESTSNAP/$TESTFILE0" "${csnapdir}/$TESTSNAP1/$TESTFILE1" \
"${csnapdir}/$TESTSNAP2/$TESTFILE2"
# setup for promote testing
typeset -i i=0
while (( i < 4 )); do
(( i = i + 1 ))
done
# verify the 'promote' operation
! snapexists $ds && \
done
[[ ! -e $data ]] && \
done
snapexists $ds && \
done
[[ -e $data ]] && \
done
[[ "$origin_prop" != "${csnap[2]}" ]] && \
[[ "$origin_prop" != "-" ]] && \
log_pass "'zfs promote' deal with multi-point snapshots as expected."