5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
24 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
29 # Copyright (c) 2016 by Delphix. All rights reserved.
32 . $STF_SUITE/include/libtest.shlib
36 # A reservation of 'none' (which is an alias for 0) should be allowed. This
37 # test verifies that is true.
40 # 1. Create a new file system in the test pool.
41 # 2. Set the reservation to 'none'.
42 # 3. Verify the associated reservation is indeed 0.
43 # 4. Repeat with reservation set to 0.
46 verify_runnable "both"
48 # Use a unique value so earlier test failures will not impact this test.
49 RESERVATION="reserve"-$$
50 RESERVATION2="reserve2"-$$
55 for FS in $TESTPOOL/$RESERVATION $TESTPOOL/$RESERVATION2
57 if datasetexists $FS ; then
58 log_must zfs unmount $FS
59 log_must zfs destroy $FS
66 log_assert "Ensure a reservation of 0 or 'none' is allowed."
68 log_must zfs create $TESTPOOL/$RESERVATION
69 log_must zfs create $TESTPOOL/$RESERVATION2
71 log_must zfs set reservation=0 $TESTPOOL/$RESERVATION
72 log_must zfs set reservation=none $TESTPOOL/$RESERVATION2
74 for FS in $TESTPOOL/$RESERVATION $TESTPOOL/$RESERVATION2
77 reserve=`zfs get -pH reservation $FS | awk '{print $3}'`
78 if [[ $reserve -ne 0 ]]; then
79 log_fail "ZFS get -p reservation did not return 0"
82 reserve=`zfs get -H reservation $FS | awk '{print $3}'`
83 if [[ $reserve != "none" ]]; then
84 log_fail "ZFS get reservation did not return 'none'"
88 log_pass "Successfully set reservation to 0 and 'none'"