1#!/bin/ksh -p 2# SPDX-License-Identifier: CDDL-1.0 3# 4# This file and its contents are supplied under the terms of the 5# Common Development and Distribution License ("CDDL"), version 1.0. 6# You may only use this file in accordance with the terms of version 7# 1.0 of the CDDL. 8# 9# A full copy of the text of the CDDL should have accompanied this 10# source. A copy of the CDDL is also available via the Internet at 11# http://www.illumos.org/license/CDDL. 12# 13 14# 15# Copyright (c) 2016 by Delphix. All rights reserved. 16# 17 18. $STF_SUITE/tests/functional/channel_program/channel_common.kshlib 19. $STF_SUITE/tests/functional/zvol/zvol_common.shlib 20 21# 22# DESCRIPTION: 23# Getting filesystem and snapshot count/limit props should work correctly. 24# 25 26verify_runnable "global" 27 28fs=$TESTPOOL/testchild 29snap=$fs@$TESTSNAP 30 31function cleanup 32{ 33 destroy_dataset $fs "-R" 34 log_must rm -rf $fs/foo 35 log_must rm -rf $fs/bar 36} 37 38log_onexit cleanup 39 40log_must zfs create $fs 41log_must zfs create $fs/foo 42create_snapshot $fs $TESTSNAP 43 44log_must_program $TESTPOOL - <<-EOF 45 ans, src = zfs.get_prop("$fs", "snapshot_limit") 46 assert(ans == -1) 47 assert(src == 'default') 48 49 ans, src = zfs.get_prop("$fs", "snapshot_count") 50 assert(ans == nil) 51 assert(src == nil) 52EOF 53 54log_must_program $TESTPOOL - <<-EOF 55 ans, src = zfs.get_prop("$fs", "filesystem_limit") 56 assert(ans == -1) 57 assert(src == 'default') 58 59 ans, src = zfs.get_prop("$fs", "filesystem_count") 60 assert(ans == nil) 61 assert(src == nil) 62EOF 63 64log_must zfs set snapshot_limit=10 $fs 65 66log_must_program $TESTPOOL - <<-EOF 67 ans, src = zfs.get_prop("$fs", "snapshot_limit") 68 assert(ans == 10) 69 assert(src == '$fs') 70 71 ans, src = zfs.get_prop("$fs", "snapshot_count") 72 assert(ans == 1) 73 assert(src == nil) 74EOF 75 76log_must zfs set filesystem_limit=8 $fs 77 78log_must zfs create $fs/bar 79 80log_must_program $TESTPOOL - <<-EOF 81 ans, src = zfs.get_prop("$fs", "filesystem_limit") 82 assert(ans == 8) 83 assert(src == '$fs') 84 85 ans, src = zfs.get_prop("$fs", "filesystem_count") 86 assert(ans == 2) 87 assert(src == nil) 88EOF 89 90log_pass "Getting filesystem and snapshot count/limit props should work correctly." 91