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_007_pos.sh
+++ new/usr/src/test/zfs-tests/tests/functional/reservation/reservation_007_pos.sh
1 1 #!/usr/bin/bash -p
2 2 #
3 3 # CDDL HEADER START
4 4 #
5 5 # The contents of this file are subject to the terms of the
6 6 # Common Development and Distribution License (the "License").
7 7 # You may not use this file except in compliance with the License.
8 8 #
9 9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 # or http://www.opensolaris.org/os/licensing.
11 11 # See the License for the specific language governing permissions
12 12 # and limitations under the License.
13 13 #
14 14 # When distributing Covered Code, include this CDDL HEADER in each
15 15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 # If applicable, add the following below this CDDL HEADER, with the
17 17 # fields enclosed by brackets "[]" replaced with your own identifying
18 18 # information: Portions Copyright [yyyy] [name of copyright owner]
|
↓ open down ↓ |
18 lines elided |
↑ open up ↑ |
19 19 #
20 20 # CDDL HEADER END
21 21 #
22 22
23 23 #
24 24 # Copyright 2007 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 on dataset should have no effect on any other
39 39 # dataset at the same level in the hierarchy beyond using up available
40 40 # space in the pool.
41 41 #
42 42 # STRATEGY:
43 43 # 1) Create a filesystem
44 44 # 2) Set a reservation on the filesystem
45 45 # 3) Create another filesystem at the same level
46 46 # 4) Set a reservation on the second filesystem
47 47 # 5) Destroy both the filesystems
48 48 # 6) Verify space accounted for correctly
|
↓ open down ↓ |
9 lines elided |
↑ open up ↑ |
49 49 #
50 50
51 51 verify_runnable "both"
52 52
53 53 log_assert "Verify reservations on data sets doesn't affect other data sets " \
54 54 "at same level except for consuming space from common pool"
55 55
56 56 function cleanup
57 57 {
58 58 datasetexists $TESTPOOL/$TESTFS2 && \
59 - log_must $ZFS destroy -f $TESTPOOL/$TESTFS2
59 + log_must zfs destroy -f $TESTPOOL/$TESTFS2
60 60
61 61 datasetexists $TESTPOOL/$TESTFS1 && \
62 - log_must $ZFS destroy -f $TESTPOOL/$TESTFS1
62 + log_must zfs destroy -f $TESTPOOL/$TESTFS1
63 63 }
64 64
65 65 log_onexit cleanup
66 66
67 67 space_avail=`get_prop available $TESTPOOL`
68 68 space_used=`get_prop used $TESTPOOL`
69 69
70 70 resv_size_set=`expr $space_avail / 3`
71 71
72 72 #
73 73 # Function which creates two datasets, sets reservations on them,
74 74 # then destroys them and ensures that space is correctly accounted
75 75 # for.
76 76 #
|
↓ open down ↓ |
4 lines elided |
↑ open up ↑ |
77 77 # Any special arguments for create are passed in via the args
78 78 # paramater.
79 79 #
80 80 function create_resv_destroy { # args1 dataset1 args2 dataset2
81 81
82 82 args1=$1
83 83 dataset1=$2
84 84 args2=$3
85 85 dataset2=$4
86 86
87 - log_must $ZFS create $args1 $dataset1
87 + log_must zfs create $args1 $dataset1
88 88
89 - log_must $ZFS set reservation=$RESV_SIZE $dataset1
89 + log_must zfs set reservation=$RESV_SIZE $dataset1
90 90
91 91 avail_aft_dset1=`get_prop available $TESTPOOL`
92 92 used_aft_dset1=`get_prop used $TESTPOOL`
93 93
94 - log_must $ZFS create $args2 $dataset2
94 + log_must zfs create $args2 $dataset2
95 95
96 - log_must $ZFS set reservation=$RESV_SIZE $dataset2
96 + log_must zfs set reservation=$RESV_SIZE $dataset2
97 97
98 98 #
99 99 # After destroying the second dataset the space used and
100 100 # available totals should revert back to the values they
101 101 # had after creating the first dataset.
102 102 #
103 - log_must $ZFS destroy -f $dataset2
103 + log_must zfs destroy -f $dataset2
104 104
105 105 avail_dest_dset2=`get_prop available $TESTPOOL`
106 106 used_dest_dset2=`get_prop used $TESTPOOL`
107 107
108 108 log_must within_limits $avail_aft_dset1 $avail_dest_dset2 $RESV_TOLERANCE
109 109 log_must within_limits $used_aft_dset1 $used_dest_dset2 $RESV_TOLERANCE
110 110
111 111
112 112 # After destroying the first dataset the space used and
113 113 # space available totals should revert back to the values
114 114 # they had when the pool was first created.
115 - log_must $ZFS destroy -f $dataset1
115 + log_must zfs destroy -f $dataset1
116 116
117 117 avail_dest_dset1=`get_prop available $TESTPOOL`
118 118 used_dest_dset1=`get_prop used $TESTPOOL`
119 119
120 120 log_must within_limits $avail_dest_dset1 $space_avail $RESV_TOLERANCE
121 121 log_must within_limits $used_dest_dset1 $space_used $RESV_TOLERANCE
122 122 }
123 123
124 124 create_resv_destroy "" $TESTPOOL/$TESTFS1 "" $TESTPOOL/$TESTFS2
125 125 create_resv_destroy "" $TESTPOOL/$TESTFS2 "" $TESTPOOL/$TESTFS1
126 126
127 127 log_pass "Verify reservations on data sets doesn't affect other data sets at" \
128 128 " same level except for consuming space from common pool"
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX