zfs_rollback_001_pos.ksh revision d583b39bfb4e2571d3e41097c5c357ffe353ad45
#
# 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 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# DESCRIPTION:
# 'zfs rollback -r|-rf|-R|-Rf' will recursively destroy any snapshots
# more recent than the one specified.
#
# STRATEGY:
# 1. Create pool, fs & volume.
# 2. Separately create three snapshots or clones for fs & volume
# 3. Roll back to the second snapshot and check the results.
# 4. Create the third snapshot or clones for fs & volume again.
# 5. Roll back to the first snapshot and check the results.
# 6. Separately create two snapshots for fs & volume.
# 7. Roll back to the first snapshot and check the results.
#
verify_runnable "both"
log_assert "'zfs rollback -r|-rf|-R|-Rf' will recursively destroy any " \
"snapshots more recent than the one specified."
#
# Create suitable test environment and run 'zfs rollback', then compare with
# expected value to check the system status.
#
# $1 option.
# $2 the number of snapshots or clones.
# $3 the number of snapshot point which we want to rollback.
#
function test_n_check #opt num_snap_clone num_rollback
{
typeset opt=$1
typeset -i cnt=$2
typeset -i pointcnt=$3
typeset dtst
log_fail "Unsupported testing condition."
# Clean up the test environment
if datasetexists $VOL; then
fi
# Create specified test environment
*r*) setup_snap_env $cnt ;;
*R*) setup_clone_env $cnt ;;
esac
typeset snap_point
typeset exist_snap
typeset exist_clone
[[ $opt == *R* ]] && exist_clone=$TESTCLONE
;;
[[ $opt == *R* ]] && exist_clone="$TESTCLONE $TESTCLONE1"
;;
esac
typeset snap
# Volume is not available in Local Zone.
if ! is_global_zone; then
break
fi
fi
if [[ $opt == *f* ]]; then
# To write data to the mountpoint directory,
fi
else
fi
else
fi
done
for clone in $all_clone; do
else
fi
done
done
}
typeset opt
#
# Currently, the test case was limited to create and rollback
# in three snapshots
#
log_note "Create 3 snapshots, rollback to the 2nd snapshot " \
"using $opt."
log_note "Create 3 snapshots and rollback to the 1st snapshot " \
"using $opt."
log_note "Create 2 snapshots and rollback to the 1st snapshot " \
"using $opt."
done
log_pass "'zfs rollback -r|-rf|-R|-Rf' recursively destroy any snapshots more "\
"recent than the one specified passed."