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/refreserv/refreserv_002_pos.ksh
          +++ new/usr/src/test/zfs-tests/tests/functional/refreserv/refreserv_002_pos.ksh
↓ 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/refreserv/refreserv.cfg
  34   34  
  35   35  #
  36   36  # DESCRIPTION:
  37   37  #       Setting full size as refreservation, verify no snapshot can be created.
  38   38  #
  39   39  # STRATEGY:
↓ open down ↓ 1 lines elided ↑ open up ↑
  41   41  #       2. Verify no snapshot can be created on this pool
  42   42  #       3. Setting full size as refreservation on filesystem
  43   43  #       4. Verify no snapshot can be created on it and its subfs
  44   44  #
  45   45  
  46   46  verify_runnable "both"
  47   47  
  48   48  function cleanup
  49   49  {
  50   50          if is_global_zone ; then
  51      -                log_must $ZFS set refreservation=none $TESTPOOL
       51 +                log_must zfs set refreservation=none $TESTPOOL
  52   52  
  53   53                  if datasetexists $TESTPOOL@snap ; then
  54      -                        log_must $ZFS destroy -f $TESTPOOL@snap
       54 +                        log_must zfs destroy -f $TESTPOOL@snap
  55   55                  fi
  56   56          fi
  57      -        log_must $ZFS destroy -rf $TESTPOOL/$TESTFS
  58      -        log_must $ZFS create $TESTPOOL/$TESTFS
  59      -        log_must $ZFS set mountpoint=$TESTDIR $TESTPOOL/$TESTFS
       57 +        log_must zfs destroy -rf $TESTPOOL/$TESTFS
       58 +        log_must zfs create $TESTPOOL/$TESTFS
       59 +        log_must zfs set mountpoint=$TESTDIR $TESTPOOL/$TESTFS
  60   60  }
  61   61  
  62   62  # This function iteratively increases refreserv to its highest possible
  63   63  # value. Simply setting refreserv == quota can allow enough writes to
  64   64  # complete that the test fails.
  65   65  function max_refreserv
  66   66  {
  67   67          typeset ds=$1
  68   68          typeset -i incsize=131072
  69   69          typeset -i rr=$(get_prop available $ds)
  70   70  
  71      -        log_must $ZFS set refreserv=$rr $ds
       71 +        log_must zfs set refreserv=$rr $ds
  72   72          while :; do
  73      -                $ZFS set refreserv=$((rr + incsize)) $ds >/dev/null 2>&1
       73 +                zfs set refreserv=$((rr + incsize)) $ds >/dev/null 2>&1
  74   74                  if [[ $? == 0 ]]; then
  75   75                          ((rr += incsize))
  76   76                          continue
  77   77                  else
  78   78                          ((incsize /= 2))
  79   79                          ((incsize == 0)) && break
  80   80                  fi
  81   81          done
  82   82  }
  83   83  
  84   84  
  85   85  log_assert "Setting full size as refreservation, verify no snapshot " \
  86   86          "can be created."
  87   87  log_onexit cleanup
  88   88  
  89      -log_must $ZFS create $TESTPOOL/$TESTFS/subfs
       89 +log_must zfs create $TESTPOOL/$TESTFS/subfs
  90   90  
  91   91  typeset datasets
  92   92  if is_global_zone; then
  93   93          datasets="$TESTPOOL $TESTPOOL/$TESTFS $TESTPOOL/$TESTFS/subfs"
  94   94  else
  95   95          datasets="$TESTPOOL/$TESTFS $TESTPOOL/$TESTFS/subfs"
  96   96  fi
  97   97  
  98   98  for ds in $datasets; do
  99   99          #
 100  100          # Verify refreservation on dataset
 101  101          #
 102      -        log_must $ZFS set quota=25M $ds
      102 +        log_must zfs set quota=25M $ds
 103  103          max_refreserv $ds
 104      -        log_mustnot $ZFS snapshot $ds@snap
      104 +        log_mustnot zfs snapshot $ds@snap
 105  105          if datasetexists $ds@snap ; then
 106  106                  log_fail "ERROR: $ds@snap should not exists."
 107  107          fi
 108  108  
 109      -        log_must $ZFS set quota=none $ds
 110      -        log_must $ZFS set refreservation=none $ds
      109 +        log_must zfs set quota=none $ds
      110 +        log_must zfs set refreservation=none $ds
 111  111  done
 112  112  
 113  113  log_pass "Setting full size as refreservation, verify no snapshot " \
 114  114          "can be created."
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX