#
# 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.
#
#
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
# Get file sum
#
# $1 full file name
{
(( ${#1} == 0 )) && \
log_fail "Need give file name."
}
# Define global variable checksum, get the original file sum.
#
#
# system or volume, then make a snapshot or clone. Repeat up to three times.
#
# $1 number of snapshot. Note: Currently only support three snapshots.
# $2 indicate if it is necessary to create clone
#
function setup_snap_env
{
typeset -i cnt=${1:-3}
if datasetnonexists $FS; then
log_must zfs set mountpoint=$TESTDIR $FS
fi
# Volume can't be created in Local Zone.
if datasetnonexists $VOL && is_global_zone; then
fi
# Make sure $VOL is volume
if datasetexists $VOL && \
#
# At the first time, Make a UFS file system in volume and
# mount it. Otherwise, only check if this ufs file system
# was mounted.
#
# Make sure the ufs filesystem hasn't been mounted,
# then mount the new ufs filesystem.
if (( $? != 0 )); then
fi
fi
# Separately Create three snapshots for file system & volume
typeset -i ind=0
typeset dtst
# Volume can be created in Local Zone.
if ! is_global_zone; then
break
fi
fi
ind=0
$FS)
;;
$VOL)
;;
esac
if datasetnonexists $snap; then
#
# using 'lockfs -f' to flush the writes to disk
# before taking a snapshot.
#
fi
fi
if datasetnonexists $clone; then
fi
fi
done
done
}
function setup_clone_env
{
setup_snap_env $1 "true"
}
#
# Clean up the test environmnet
#
# $1 number of snapshot Note: Currently only support three snapshots.
#
function cleanup_env
{
typeset -i cnt=${1:-3}
typeset -i ind=0
typeset dtst
typeset snap
if (( $? == 0 )); then
fi
for snap in $TESTSNAP $TESTSNAP1 $TESTSNAP2; do
if snapexists $dtst@$snap; then
fi
done
done
# Restore original test environment
if datasetnonexists $FS ; then
fi
if datasetnonexists $VOL ; then
if is_global_zone ; then
else
fi
fi
}
#
# check if the specified files have specified status.
#
# $1 expected status
# $2-n full file name
# If it is true return 0, else return 1
#
function file_status
{
(( $# == 0 )) && \
log_fail "The file name is not defined."
typeset opt
case $1 in
esac
shift
while (( $# > 0 )); do
eval [[ $opt $1 ]] || return 1
shift
done
return 0
}
function files_exist
{
}
function files_nonexist
{
}
#
# According to snapshot check if the file system was recovered to the right
# point.
#
# $1 snapshot. fs@snap or vol@snap
#
function check_files
{
typeset dtst=$1
log_fail "Parameter must be a snapshot."
fi
ind=""
else
ind="1"
fi
then
log_fail "After rollback, file sum is changed."
fi
;;
then
log_fail "After rollback, file sum is changed."
fi
;;
log_fail "After rollback, file sum is changed."
fi
;;
esac
}
# According to dataset type, write file to different directories.
#
# $1 dataset
#
function write_mountpoint_dir
{
typeset dtst=$1
typeset dir
else
fi
}