history_002_pos.ksh revision f38cb554a534c6df738be3f4d23327e69888e634
#
# 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 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Copyright (c) 2013 by Delphix. All rights reserved.
#
#
# DESCRIPTION:
# Create a scenario to verify the following zfs subcommands are logged.
# create, destroy, clone, rename, snapshot, rollback, set, inherit,
# receive, promote, hold and release.
#
# STRATEGY:
# 1. Verify that all the zfs commands listed (barring send) produce an
# entry in the pool history.
#
verify_runnable "global"
function cleanup
{
done
}
log_assert "Verify zfs sub-commands which modify state are logged."
# property value property value
#
props=(
quota 64M recordsize 512
mountpoint /history.$$ mountpoint legacy
)
run_and_verify "$ZFS create $fs"
# Set all the property for filesystem
typeset -i i=0
while ((i < ${#props[@]})) ; do
run_and_verify "$ZFS set ${props[$i]}=${props[((i+1))]} $fs"
# quota, reservation, canmount can not be inherited.
#
then
run_and_verify "$ZFS inherit ${props[$i]} $fs"
fi
((i += 2))
done
run_and_verify "$ZFS create -V 64M $vol"
run_and_verify "$ZFS set volsize=32M $vol"
run_and_verify "$ZFS snapshot $fssnap"
run_and_verify "$ZFS hold tag $fssnap"
run_and_verify "$ZFS release tag $fssnap"
run_and_verify "$ZFS snapshot $volsnap"
run_and_verify "$ZFS snapshot $fssnap2"
run_and_verify "$ZFS snapshot $volsnap2"
# Send isn't logged...
# Verify that's true
run_and_verify "$ZFS destroy $fssnap2"
run_and_verify "$ZFS destroy $volsnap2"
run_and_verify "$ZFS receive $fs < $tmpfile"
run_and_verify "$ZFS receive $vol < $tmpfile2"
run_and_verify "$ZFS rollback -r $fssnap"
run_and_verify "$ZFS rollback -r $volsnap"
run_and_verify "$ZFS clone $fssnap $fsclone"
run_and_verify "$ZFS clone $volsnap $volclone"
run_and_verify "$ZFS rename $fs $newfs"
run_and_verify "$ZFS rename $vol $newvol"
run_and_verify "$ZFS promote $fsclone"
run_and_verify "$ZFS promote $volclone"
run_and_verify "$ZFS destroy $newfs"
run_and_verify "$ZFS destroy $newvol"
run_and_verify "$ZFS destroy -rf $fsclone"
run_and_verify "$ZFS destroy -rf $volclone"
log_pass "zfs sub-commands which modify state are logged passed."