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_001_pos.sh
          +++ new/usr/src/test/zfs-tests/tests/functional/reservation/reservation_001_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 2008 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  # ZFS allows reservations to be set on filesystems and volumes, provided
  39   39  # the reservation is less than the space available in the pool.
↓ open down ↓ 7 lines elided ↑ open up ↑
  47   47  #    the correct value.
  48   48  # 5) Reset the reservation to 'none'
  49   49  # 6) Repeat steps 2-5 for both volume types
  50   50  #
  51   51  
  52   52  verify_runnable "both"
  53   53  
  54   54  function cleanup
  55   55  {
  56   56          for obj in $OBJ_LIST; do
  57      -                datasetexists $obj && log_must $ZFS destroy -f $obj
       57 +                datasetexists $obj && log_must zfs destroy -f $obj
  58   58          done
  59   59  }
  60   60  
  61   61  log_onexit cleanup
  62   62  
  63   63  log_assert "Verify that to set a reservation on a filesystem or volume must " \
  64   64      "use value smaller than space available property of pool"
  65   65  
  66   66  space_avail=`get_prop available $TESTPOOL`
  67   67  
↓ open down ↓ 5 lines elided ↑ open up ↑
  73   73          ((vol_set_size = space_avail / 4))
  74   74          vol_set_size=$(floor_volsize $vol_set_size)
  75   75          ((sparse_vol_set_size = space_avail * 4))
  76   76          sparse_vol_set_size=$(floor_volsize $sparse_vol_set_size)
  77   77  
  78   78          #
  79   79          # Note that when creating a regular volume we are implicitly
  80   80          # setting a reservation upon it (i.e. the size of the volume)
  81   81          # which we reset back to zero initially.
  82   82          #
  83      -        log_must $ZFS create -V $vol_set_size $TESTPOOL/$TESTVOL
  84      -        log_must $ZFS set reservation=none $TESTPOOL/$TESTVOL
  85      -        log_must $ZFS set refreservation=none $TESTPOOL/$TESTVOL
  86      -        log_must $ZFS create -s -V $sparse_vol_set_size $TESTPOOL/$TESTVOL2
       83 +        log_must zfs create -V $vol_set_size $TESTPOOL/$TESTVOL
       84 +        log_must zfs set reservation=none $TESTPOOL/$TESTVOL
       85 +        log_must zfs set refreservation=none $TESTPOOL/$TESTVOL
       86 +        log_must zfs create -s -V $sparse_vol_set_size $TESTPOOL/$TESTVOL2
  87   87  fi
  88   88  
  89   89  
  90   90  for obj in $TESTPOOL/$TESTFS $OBJ_LIST; do
  91   91  
  92   92          space_avail=`get_prop available $TESTPOOL`
  93   93          resv_size_set=`expr $space_avail - $RESV_DELTA`
  94   94  
  95   95          #
  96   96          # For a regular (non-sparse) volume the upper limit
  97   97          # for reservations is not determined by the space
  98   98          # available in the pool but rather by the size of
  99   99          # the volume itself.
 100  100          #
 101  101          [[ $obj == $TESTPOOL/$TESTVOL ]] && \
 102  102              ((resv_size_set = vol_set_size - RESV_DELTA))
 103  103  
 104      -        log_must $ZFS set reservation=$resv_size_set $obj
      104 +        log_must zfs set reservation=$resv_size_set $obj
 105  105  
 106  106          resv_size_get=`get_prop reservation $obj`
 107  107          if [[ $resv_size_set != $resv_size_get ]]; then
 108  108                  log_fail "Reservation not the expected value " \
 109  109                      "($resv_size_set != $resv_size_get)"
 110  110          fi
 111  111  
 112  112          log_must zero_reservation $obj
 113  113  
 114  114          new_space_avail=`get_prop available $obj`
 115  115  
 116  116          #
 117  117          # Due to the way space is consumed and released by metadata we
 118  118          # can't do an exact check here, but we do do a basic sanity
 119  119          # check.
 120  120          #
 121  121          log_must within_limits $space_avail $new_space_avail $RESV_TOLERANCE
 122  122  done
 123  123  
 124  124  log_pass "Successfully set reservation on filesystem and volume"
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX