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 2009 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
29 # Copyright (c) 2013, 2016 by Delphix. All rights reserved.
32 .
$STF_SUITE/include
/libtest.shlib
33 .
$STF_SUITE/tests
/functional
/userquota
/userquota_common.kshlib
37 # the userquota and groupquota will not change during zfs actions, such as
38 # snapshot,clone,rename,upgrade,send,receive.
42 # 1. Create a pool, and create fs with preset user,group quota
43 # 2. Check set user|group quota via zfs snapshot|clone|list -o
44 # 3. Check the user|group quota can not change during zfs rename|upgrade|promote
45 # 4. Check the user|group quota can not change during zfs clone
46 # 5. Check the user|group quota can not change during zfs send/receive
51 for ds
in $TESTPOOL/fs
$TESTPOOL/fs-rename
$TESTPOOL/fs-clone
; do
52 if datasetexists
$ds; then
53 log_must zfs destroy
-rRf $ds
61 "the userquota and groupquota can't change during zfs actions"
65 log_must zfs create
-o userquota@
$QUSER1=$UQUOTA_SIZE \
66 -o groupquota@
$QGROUP=$GQUOTA_SIZE $TESTPOOL/fs
68 log_must zfs snapshot
$TESTPOOL/fs@snap
69 log_must
eval "zfs list -r -o userquota@$QUSER1,groupquota@$QGROUP \
70 $TESTPOOL >/dev/null 2>&1"
72 log_must check_quota
"userquota@$QUSER1" $TESTPOOL/fs@snap
"$UQUOTA_SIZE"
73 log_must check_quota
"groupquota@$QGROUP" $TESTPOOL/fs@snap
"$GQUOTA_SIZE"
76 log_note
"clone fs gets its parent's userquota/groupquota initially"
77 log_must zfs clone
-o userquota@
$QUSER1=$UQUOTA_SIZE \
78 -o groupquota@
$QGROUP=$GQUOTA_SIZE \
79 $TESTPOOL/fs@snap
$TESTPOOL/fs-clone
81 log_must
eval "zfs list -r -o userquota@$QUSER1,groupquota@$QGROUP \
82 $TESTPOOL >/dev/null 2>&1"
84 log_must check_quota
"userquota@$QUSER1" $TESTPOOL/fs-clone
"$UQUOTA_SIZE"
85 log_must check_quota
"groupquota@$QGROUP" $TESTPOOL/fs-clone
"$GQUOTA_SIZE"
87 log_must
eval "zfs list -o userquota@$QUSER1,groupquota@$QGROUP \
88 $TESTPOOL/fs-clone >/dev/null 2>&1"
90 log_note
"zfs promote can not change the previously set user|group quota"
91 log_must zfs promote
$TESTPOOL/fs-clone
93 log_must
eval "zfs list -r -o userquota@$QUSER1,groupquota@$QGROUP \
94 $TESTPOOL >/dev/null 2>&1"
96 log_must check_quota
"userquota@$QUSER1" $TESTPOOL/fs-clone
"$UQUOTA_SIZE"
97 log_must check_quota
"groupquota@$QGROUP" $TESTPOOL/fs-clone
"$GQUOTA_SIZE"
99 log_note
"zfs send receive can not change the previously set user|group quota"
100 log_must zfs send
$TESTPOOL/fs-clone@snap | zfs receive
$TESTPOOL/fs-rev
102 log_must
eval "zfs list -r -o userquota@$QUSER1,groupquota@$QGROUP \
103 $TESTPOOL >/dev/null 2>&1"
105 log_must check_quota
"userquota@$QUSER1" $TESTPOOL/fs-rev
"$UQUOTA_SIZE"
106 log_must check_quota
"groupquota@$QGROUP" $TESTPOOL/fs-rev
"$GQUOTA_SIZE"
108 log_note
"zfs rename can not change the previously set user|group quota"
109 log_must zfs rename
$TESTPOOL/fs-rev
$TESTPOOL/fs-rename
111 log_must
eval "zfs list -r -o userquota@$QUSER1,groupquota@$QGROUP \
112 $TESTPOOL >/dev/null 2>&1"
114 log_must check_quota
"userquota@$QUSER1" $TESTPOOL/fs-rename
"$UQUOTA_SIZE"
115 log_must check_quota
"groupquota@$QGROUP" $TESTPOOL/fs-rename
"$GQUOTA_SIZE"
117 log_note
"zfs upgrade can not change the previously set user|group quota"
118 log_must zfs upgrade
$TESTPOOL/fs-rename
120 log_must
eval "zfs list -r -o userquota@$QUSER1,groupquota@$QGROUP \
121 $TESTPOOL >/dev/null 2>&1"
123 log_must check_quota
"userquota@$QUSER1" $TESTPOOL/fs-rename
"$UQUOTA_SIZE"
124 log_must check_quota
"groupquota@$QGROUP" $TESTPOOL/fs-rename
"$GQUOTA_SIZE"
127 "the userquota and groupquota can't change during zfs actions"