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>

Split Close
Expand all
Collapse all
          --- old/usr/src/test/zfs-tests/tests/functional/reservation/reservation_008_pos.sh
          +++ new/usr/src/test/zfs-tests/tests/functional/reservation/reservation_008_pos.sh
↓ open down ↓ 18 lines elided ↑ open up ↑
  19   19  #
  20   20  # CDDL HEADER END
  21   21  #
  22   22  
  23   23  #
  24   24  # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  25   25  # Use is subject to license terms.
  26   26  #
  27   27  
  28   28  #
  29      -# Copyright (c) 2013 by Delphix. All rights reserved.
       29 +# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
  30   30  #
  31   31  
  32   32  . $STF_SUITE/include/libtest.shlib
  33   33  . $STF_SUITE/tests/functional/reservation/reservation.shlib
  34   34  
  35   35  #
  36   36  # DESCRIPTION:
  37   37  #
  38   38  # Setting a reservation reserves a defined minimum amount of space for
  39   39  # a dataset, and prevents other datasets using that space. Verify that
↓ open down ↓ 10 lines elided ↑ open up ↑
  50   50  
  51   51  verify_runnable "both"
  52   52  
  53   53  log_assert "Verify reducing reservation allows other datasets to use space"
  54   54  
  55   55  function cleanup
  56   56  {
  57   57          typeset -i loop=0
  58   58          while (($loop < $RESV_NUM_FS)); do
  59   59                  datasetexists $TESTPOOL/${TESTFS}$loop && \
  60      -                    log_must $ZFS destroy -f $TESTPOOL/${TESTFS}$loop
       60 +                    log_must zfs destroy -f $TESTPOOL/${TESTFS}$loop
  61   61  
  62      -                [[ -d ${TESTDIR}$loop ]] && log_must $RM -r ${TESTDIR}$loop
       62 +                [[ -d ${TESTDIR}$loop ]] && log_must rm -r ${TESTDIR}$loop
  63   63  
  64   64                  ((loop = loop + 1))
  65   65          done
  66   66  }
  67   67  
  68   68  log_onexit cleanup
  69   69  
  70   70  log_must create_multiple_fs $RESV_NUM_FS $TESTPOOL/$TESTFS $TESTDIR
  71   71  
  72   72  space_avail=`get_prop available $TESTPOOL`
↓ open down ↓ 12 lines elided ↑ open up ↑
  85   85  
  86   86  #
  87   87  # We set the reservations now, rather than when we created the filesystems
  88   88  # to allow us to take into account space used by the filsystem metadata
  89   89  #
  90   90  # Note we don't set a reservation on the first filesystem we created,
  91   91  # hence num=1 rather than zero below.
  92   92  #
  93   93  typeset -i num=1
  94   94  while (($num < $RESV_NUM_FS)); do
  95      -        log_must $ZFS set reservation=$resv_size_set $TESTPOOL/$TESTFS$num
       95 +        log_must zfs set reservation=$resv_size_set $TESTPOOL/$TESTFS$num
  96   96          ((num = num + 1))
  97   97  done
  98   98  
  99   99  space_avail_still=`get_prop available $TESTPOOL`
 100  100  
 101  101  fill_size=`expr $space_avail_still + $RESV_TOLERANCE`
 102  102  write_count=`expr $fill_size / $BLOCK_SIZE`
 103  103  
 104  104  # Now fill up the first filesystem (which doesn't have a reservation set
 105  105  # and thus will use up whatever free space is left in the pool).
 106  106  num=0
 107  107  log_note "Writing to $TESTDIR$num/$TESTFILE1"
 108  108  
 109      -$FILE_WRITE -o create -f $TESTDIR$num/$TESTFILE1 -b $BLOCK_SIZE \
      109 +file_write -o create -f $TESTDIR$num/$TESTFILE1 -b $BLOCK_SIZE \
 110  110      -c $write_count -d 0
 111  111  ret=$?
 112  112  if (($ret != $ENOSPC)); then
 113  113          log_fail "Did not get ENOSPC as expected (got $ret)."
 114  114  fi
 115  115  
 116  116  # Remove the reservation on one of the other filesystems and verify
 117  117  # can write more data to the original non-reservation filesystem.
 118  118  num=1
 119      -log_must $ZFS set reservation=none $TESTPOOL/${TESTFS}$num
      119 +log_must zfs set reservation=none $TESTPOOL/${TESTFS}$num
 120  120  num=0
 121      -log_must $FILE_WRITE -o create -f ${TESTDIR}$num/$TESTFILE2 -b $PAGESIZE \
      121 +log_must file_write -o create -f ${TESTDIR}$num/$TESTFILE2 -b pagesize \
 122  122      -c 1000 -d 0
 123  123  
 124  124  log_pass "reducing reservation allows other datasets to use space"
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX