Print this page
7290 ZFS test suite needs to control what utilities it can run
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
*** 24,34 ****
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
! # Copyright (c) 2013 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/refreserv/refreserv.cfg
--- 24,34 ----
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
! # Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/refreserv/refreserv.cfg
*** 46,64 ****
verify_runnable "both"
function cleanup
{
if is_global_zone ; then
! log_must $ZFS set refreservation=none $TESTPOOL
if datasetexists $TESTPOOL@snap ; then
! log_must $ZFS destroy -f $TESTPOOL@snap
fi
fi
! log_must $ZFS destroy -rf $TESTPOOL/$TESTFS
! log_must $ZFS create $TESTPOOL/$TESTFS
! log_must $ZFS set mountpoint=$TESTDIR $TESTPOOL/$TESTFS
}
# This function iteratively increases refreserv to its highest possible
# value. Simply setting refreserv == quota can allow enough writes to
# complete that the test fails.
--- 46,64 ----
verify_runnable "both"
function cleanup
{
if is_global_zone ; then
! log_must zfs set refreservation=none $TESTPOOL
if datasetexists $TESTPOOL@snap ; then
! log_must zfs destroy -f $TESTPOOL@snap
fi
fi
! log_must zfs destroy -rf $TESTPOOL/$TESTFS
! log_must zfs create $TESTPOOL/$TESTFS
! log_must zfs set mountpoint=$TESTDIR $TESTPOOL/$TESTFS
}
# This function iteratively increases refreserv to its highest possible
# value. Simply setting refreserv == quota can allow enough writes to
# complete that the test fails.
*** 66,78 ****
{
typeset ds=$1
typeset -i incsize=131072
typeset -i rr=$(get_prop available $ds)
! log_must $ZFS set refreserv=$rr $ds
while :; do
! $ZFS set refreserv=$((rr + incsize)) $ds >/dev/null 2>&1
if [[ $? == 0 ]]; then
((rr += incsize))
continue
else
((incsize /= 2))
--- 66,78 ----
{
typeset ds=$1
typeset -i incsize=131072
typeset -i rr=$(get_prop available $ds)
! log_must zfs set refreserv=$rr $ds
while :; do
! zfs set refreserv=$((rr + incsize)) $ds >/dev/null 2>&1
if [[ $? == 0 ]]; then
((rr += incsize))
continue
else
((incsize /= 2))
*** 84,94 ****
log_assert "Setting full size as refreservation, verify no snapshot " \
"can be created."
log_onexit cleanup
! log_must $ZFS create $TESTPOOL/$TESTFS/subfs
typeset datasets
if is_global_zone; then
datasets="$TESTPOOL $TESTPOOL/$TESTFS $TESTPOOL/$TESTFS/subfs"
else
--- 84,94 ----
log_assert "Setting full size as refreservation, verify no snapshot " \
"can be created."
log_onexit cleanup
! log_must zfs create $TESTPOOL/$TESTFS/subfs
typeset datasets
if is_global_zone; then
datasets="$TESTPOOL $TESTPOOL/$TESTFS $TESTPOOL/$TESTFS/subfs"
else
*** 97,114 ****
for ds in $datasets; do
#
# Verify refreservation on dataset
#
! log_must $ZFS set quota=25M $ds
max_refreserv $ds
! log_mustnot $ZFS snapshot $ds@snap
if datasetexists $ds@snap ; then
log_fail "ERROR: $ds@snap should not exists."
fi
! log_must $ZFS set quota=none $ds
! log_must $ZFS set refreservation=none $ds
done
log_pass "Setting full size as refreservation, verify no snapshot " \
"can be created."
--- 97,114 ----
for ds in $datasets; do
#
# Verify refreservation on dataset
#
! log_must zfs set quota=25M $ds
max_refreserv $ds
! log_mustnot zfs snapshot $ds@snap
if datasetexists $ds@snap ; then
log_fail "ERROR: $ds@snap should not exists."
fi
! log_must zfs set quota=none $ds
! log_must zfs set refreservation=none $ds
done
log_pass "Setting full size as refreservation, verify no snapshot " \
"can be created."