1#!/usr/bin/bash -p 2# 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 6# 1.0 of the CDDL. 7# 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. 11# 12 13# 14# Copyright 2018 Joyent, Inc. 15# 16 17. $STF_SUITE/include/libtest.shlib 18. $STF_SUITE/tests/functional/reservation/reservation.shlib 19 20# 21# DESCRIPTION: 22# 23# The use of refreservation=auto on a filesystem does not change the 24# refreservation and results in an error. 25# 26# STRATEGY: 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. 33# 34 35verify_runnable "both" 36 37fs=$TESTPOOL/$TESTFS/$(basename $0).$$ 38 39function cleanup 40{ 41 if datasetexists "$fs"; then 42 log_must zfs destroy -f "$fs" 43 fi 44} 45 46log_onexit cleanup 47 48log_assert "refreservation=auto on a filesystem generates an error without" \ 49 "changing refreservation" 50 51space_avail=$(get_prop available $TESTPOOL) 52(( fs_size = space_avail / 4 )) 53 54# Create a filesystem with no refreservation 55log_must zfs create $fs 56resv=$(get_prop refreservation $fs) 57log_must test $resv -eq 0 58 59# Verify that refreservation=auto fails without altering refreservation 60log_mustnot zfs set refreservation=auto $fs 61resv=$(get_prop refreservation $fs) 62log_must test $resv -eq 0 63 64# Set refreservation and verify 65log_must zfs set refreservation=$fs_size $fs 66resv=$(get_prop refreservation $fs) 67log_must test $resv -eq $fs_size 68 69# Verify that refreservation=auto fails without altering refreservation 70log_mustnot zfs set refreservation=auto $fs 71resv=$(get_prop refreservation $fs) 72log_must test $resv -eq $fs_size 73 74log_pass "refreservation=auto does not work on filesystems, as expected" 75