3 # This file and its contents are supplied under the terms of the
4 # Common Development and Distribution License ("CDDL"), version 1.0.
5 # You may only use this file in accordance with the terms of version
8 # A full copy of the text of the CDDL should have accompanied this
9 # source. A copy of the CDDL is also available via the Internet at
10 # http://www.illumos.org/license/CDDL.
14 # Copyright 2018 Joyent, Inc.
17 . $STF_SUITE/include/libtest.shlib
18 . $STF_SUITE/tests/functional/reservation/reservation.shlib
23 # The use of refreservation=auto on a filesystem does not change the
24 # refreservation and results in an error.
27 # 1) Create a filesystem
28 # 2) Verify that zfs set refreservation=auto fails without changing
29 # refreservation from none.
30 # 3) Set refreservation to a valid value.
31 # 4) Verify that zfs set refreservation=auto fails without changing
32 # refreservation from the previous value.
35 verify_runnable "both"
37 fs=$TESTPOOL/$TESTFS/$(basename $0).$$
41 destroy_dataset "$fs" "-f"
46 log_assert "refreservation=auto on a filesystem generates an error without" \
47 "changing refreservation"
49 space_avail=$(get_prop available $TESTPOOL)
50 (( fs_size = space_avail / 4 ))
52 # Create a filesystem with no refreservation
53 log_must zfs create $fs
54 resv=$(get_prop refreservation $fs)
55 log_must test $resv -eq 0
57 # Verify that refreservation=auto fails without altering refreservation
58 log_mustnot zfs set refreservation=auto $fs
59 resv=$(get_prop refreservation $fs)
60 log_must test $resv -eq 0
62 # Set refreservation and verify
63 log_must zfs set refreservation=$fs_size $fs
64 resv=$(get_prop refreservation $fs)
65 log_must test $resv -eq $fs_size
67 # Verify that refreservation=auto fails without altering refreservation
68 log_mustnot zfs set refreservation=auto $fs
69 resv=$(get_prop refreservation $fs)
70 log_must test $resv -eq $fs_size
72 log_pass "refreservation=auto does not work on filesystems, as expected"