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/reservation/reservation.shlib --- 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/reservation/reservation.shlib
*** 52,62 **** function cleanup { # # Note we don't destroy $TESTFS as it's used by other tests for obj in $OBJ_LIST ; do ! datasetexists $obj && log_must $ZFS destroy -f $obj done log_must zero_reservation $TESTPOOL/$TESTFS } log_onexit cleanup --- 52,62 ---- function cleanup { # # Note we don't destroy $TESTFS as it's used by other tests for obj in $OBJ_LIST ; do ! datasetexists $obj && log_must zfs destroy -f $obj done log_must zero_reservation $TESTPOOL/$TESTFS } log_onexit cleanup
*** 71,82 **** ((vol_set_size = space_avail / 4)) vol_set_size=$(floor_volsize $vol_set_size) ((sparse_vol_set_size = space_avail * 4)) sparse_vol_set_size=$(floor_volsize $sparse_vol_set_size) ! log_must $ZFS create -V $vol_set_size $TESTPOOL/$TESTVOL ! log_must $ZFS create -s -V $sparse_vol_set_size $TESTPOOL/$TESTVOL2 fi for obj in $TESTPOOL/$TESTFS $OBJ_LIST ; do space_avail=`get_prop available $TESTPOOL` --- 71,82 ---- ((vol_set_size = space_avail / 4)) vol_set_size=$(floor_volsize $vol_set_size) ((sparse_vol_set_size = space_avail * 4)) sparse_vol_set_size=$(floor_volsize $sparse_vol_set_size) ! log_must zfs create -V $vol_set_size $TESTPOOL/$TESTVOL ! log_must zfs create -s -V $sparse_vol_set_size $TESTPOOL/$TESTVOL2 fi for obj in $TESTPOOL/$TESTFS $OBJ_LIST ; do space_avail=`get_prop available $TESTPOOL`
*** 91,101 **** # reservation value that can be set on a volume is # determined by the size of the volume or the amount of # space in the pool, whichever is smaller. # if [[ $obj == $TESTPOOL/$TESTFS ]]; then ! log_must $ZFS set quota=$quota_set_size $obj ((resv_set_size = quota_set_size + RESV_SIZE)) elif [[ $obj == $TESTPOOL/$TESTVOL2 ]] ; then ((resv_set_size = sparse_vol_set_size + RESV_SIZE)) --- 91,101 ---- # reservation value that can be set on a volume is # determined by the size of the volume or the amount of # space in the pool, whichever is smaller. # if [[ $obj == $TESTPOOL/$TESTFS ]]; then ! log_must zfs set quota=$quota_set_size $obj ((resv_set_size = quota_set_size + RESV_SIZE)) elif [[ $obj == $TESTPOOL/$TESTVOL2 ]] ; then ((resv_set_size = sparse_vol_set_size + RESV_SIZE))
*** 105,123 **** ((resv_set_size = vol_set_size + RESV_SIZE)) fi orig_quota=`get_prop quota $obj` ! log_mustnot $ZFS set reservation=$resv_set_size $obj new_quota=`get_prop quota $obj` if [[ $orig_quota != $new_quota ]]; then log_fail "Quota value changed from $orig_quota " \ "to $new_quota" fi if [[ $obj == $TESTPOOL/$TESTFS ]]; then ! log_must $ZFS set quota=none $obj fi done log_pass "As expected cannot set reservation larger than quota" --- 105,123 ---- ((resv_set_size = vol_set_size + RESV_SIZE)) fi orig_quota=`get_prop quota $obj` ! log_mustnot zfs set reservation=$resv_set_size $obj new_quota=`get_prop quota $obj` if [[ $orig_quota != $new_quota ]]; then log_fail "Quota value changed from $orig_quota " \ "to $new_quota" fi if [[ $obj == $TESTPOOL/$TESTFS ]]; then ! log_must zfs set quota=none $obj fi done log_pass "As expected cannot set reservation larger than quota"