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_013_pos.sh
+++ new/usr/src/test/zfs-tests/tests/functional/reservation/reservation_013_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 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 # Reservation properties on data objects should be preserved when the
39 39 # pool within which they are contained is exported and then re-imported.
40 40 #
41 41 #
42 42 # STRATEGY:
43 43 # 1) Create a filesystem as dataset
44 44 # 2) Create another filesystem at the same level
45 45 # 3) Create a regular volume at the same level
46 46 # 4) Create a sparse volume at the same level
47 47 # 5) Create a filesystem within the dataset filesystem
48 48 # 6) Set reservations on all filesystems
49 49 # 7) Export the pool
50 50 # 8) Re-import the pool
|
↓ open down ↓ |
11 lines elided |
↑ open up ↑ |
51 51 # 9) Verify that the reservation settings are correct
52 52 #
53 53
54 54 verify_runnable "global"
55 55
56 56 log_assert "Reservation properties preserved across exports and imports"
57 57
58 58 function cleanup
59 59 {
60 60 for obj in $OBJ_LIST; do
61 - datasetexists $obj && log_must $ZFS destroy -f $obj
61 + datasetexists $obj && log_must zfs destroy -f $obj
62 62 done
63 63
64 64 log_must zero_reservation $TESTPOOL/$TESTFS
65 65 }
66 66 log_onexit cleanup
67 67
68 68 OBJ_LIST="$TESTPOOL/$TESTFS1/$TESTFS2 $TESTPOOL/$TESTFS1 $TESTPOOL/$TESTVOL \
69 69 $TESTPOOL/$TESTVOL2"
70 70
71 -log_must $ZFS create $TESTPOOL/$TESTFS1
72 -log_must $ZFS create $TESTPOOL/$TESTFS1/$TESTFS2
71 +log_must zfs create $TESTPOOL/$TESTFS1
72 +log_must zfs create $TESTPOOL/$TESTFS1/$TESTFS2
73 73
74 74 space_avail=$(get_prop available $TESTPOOL)
75 75 [[ $? -ne 0 ]] && \
76 76 log_fail "Unable to get space available property for $TESTPOOL"
77 77
78 78 ((resv_set = space_avail / 5))
79 79 resv_set=$(floor_volsize $resv_set)
80 80 ((sparse_vol_set_size = space_avail * 5))
81 81 sparse_vol_set_size=$(floor_volsize $sparse_vol_set_size)
82 82
83 83 # When initially created, a regular volume's reservation property is set
84 84 # equal to its size (unlike a sparse volume), so we don't need to set it
85 85 # explictly later on
86 -log_must $ZFS create -V $resv_set $TESTPOOL/$TESTVOL
87 -log_must $ZFS create -s -V $sparse_vol_set_size $TESTPOOL/$TESTVOL2
86 +log_must zfs create -V $resv_set $TESTPOOL/$TESTVOL
87 +log_must zfs create -s -V $sparse_vol_set_size $TESTPOOL/$TESTVOL2
88 88
89 -log_must $ZFS set reservation=$resv_set $TESTPOOL/$TESTFS
90 -log_must $ZFS set reservation=$resv_set $TESTPOOL/$TESTFS1
91 -log_must $ZFS set reservation=$resv_set $TESTPOOL/$TESTFS1/$TESTFS2
92 -log_must $ZFS set reservation=$resv_set $TESTPOOL/$TESTVOL2
89 +log_must zfs set reservation=$resv_set $TESTPOOL/$TESTFS
90 +log_must zfs set reservation=$resv_set $TESTPOOL/$TESTFS1
91 +log_must zfs set reservation=$resv_set $TESTPOOL/$TESTFS1/$TESTFS2
92 +log_must zfs set reservation=$resv_set $TESTPOOL/$TESTVOL2
93 93
94 -log_must $ZPOOL export $TESTPOOL
95 -log_must $ZPOOL import $TESTPOOL
94 +log_must zpool export $TESTPOOL
95 +log_must zpool import $TESTPOOL
96 96
97 97 for obj in $TESTPOOL/$TESTFS $OBJ_LIST; do
98 98
99 99 if [[ $obj == $TESTPOOL/$TESTVOL ]]; then
100 100 expected=$(volsize_to_reservation $obj $resv_set)
101 101 found=$(get_prop refreservation $obj)
102 102 else
103 103 expected=$resv_set
104 104 found=$(get_prop reservation $obj)
105 105 fi
106 106
107 107 [[ $found != $expected ]] && \
108 108 log_fail "Reservation property for $obj incorrect. Expected " \
109 109 "$expected but got $found."
110 110 done
111 111
112 112 log_pass "Reservation properties preserved across exports and imports"
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX