Add tests for defaultuserquota/defaultgroupquota feature
These are based on the existing userquota tests. Note that because the default{user|group}quota behavior differs from Solaris during snapshot/clone/promote, some of the tests fail by design. Signed-off-by: Todd Seidelmann <seidelma@wharton.upenn.edu>
This commit is contained in:
parent
03006174b7
commit
f728f2eb51
|
@ -979,6 +979,11 @@ tags = ['functional', 'upgrade']
|
||||||
|
|
||||||
[tests/functional/userquota]
|
[tests/functional/userquota]
|
||||||
tests = [
|
tests = [
|
||||||
|
'defaultuserquota_001_pos', 'defaultuserquota_002_pos',
|
||||||
|
'defaultuserquota_003_pos', 'defaultuserquota_004_neg',
|
||||||
|
'defaultuserquota_005_pos', 'defaultuserquota_006_pos',
|
||||||
|
'defaultuserquota_007_pos', 'defaultuserquota_008_pos',
|
||||||
|
'defaultuserquota_009_pos', 'defaultuserquota_010_neg',
|
||||||
'userquota_001_pos', 'userquota_002_pos', 'userquota_003_pos',
|
'userquota_001_pos', 'userquota_002_pos', 'userquota_003_pos',
|
||||||
'userquota_004_pos', 'userquota_005_neg', 'userquota_006_pos',
|
'userquota_004_pos', 'userquota_005_neg', 'userquota_006_pos',
|
||||||
'userquota_007_pos', 'userquota_008_pos', 'userquota_009_pos',
|
'userquota_007_pos', 'userquota_008_pos', 'userquota_009_pos',
|
||||||
|
|
|
@ -2037,6 +2037,16 @@ nobase_dist_datadir_zfs_tests_tests_SCRIPTS += \
|
||||||
functional/userquota/groupspace_002_pos.ksh \
|
functional/userquota/groupspace_002_pos.ksh \
|
||||||
functional/userquota/groupspace_003_pos.ksh \
|
functional/userquota/groupspace_003_pos.ksh \
|
||||||
functional/userquota/setup.ksh \
|
functional/userquota/setup.ksh \
|
||||||
|
functional/userquota/defaultuserquota_001_pos.ksh \
|
||||||
|
functional/userquota/defaultuserquota_002_pos.ksh \
|
||||||
|
functional/userquota/defaultuserquota_003_pos.ksh \
|
||||||
|
functional/userquota/defaultuserquota_004_neg.ksh \
|
||||||
|
functional/userquota/defaultuserquota_005_pos.ksh \
|
||||||
|
functional/userquota/defaultuserquota_006_pos.ksh \
|
||||||
|
functional/userquota/defaultuserquota_007_pos.ksh \
|
||||||
|
functional/userquota/defaultuserquota_008_pos.ksh \
|
||||||
|
functional/userquota/defaultuserquota_009_pos.ksh \
|
||||||
|
functional/userquota/defaultuserquota_010_neg.ksh \
|
||||||
functional/userquota/userquota_001_pos.ksh \
|
functional/userquota/userquota_001_pos.ksh \
|
||||||
functional/userquota/userquota_002_pos.ksh \
|
functional/userquota/userquota_002_pos.ksh \
|
||||||
functional/userquota/userquota_003_pos.ksh \
|
functional/userquota/userquota_003_pos.ksh \
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
#!/bin/ksh -p
|
||||||
|
#
|
||||||
|
# CDDL HEADER START
|
||||||
|
#
|
||||||
|
# The contents of this file are subject to the terms of the
|
||||||
|
# Common Development and Distribution License (the "License").
|
||||||
|
# You may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||||
|
# or https://opensource.org/licenses/CDDL-1.0.
|
||||||
|
# See the License for the specific language governing permissions
|
||||||
|
# and limitations under the License.
|
||||||
|
#
|
||||||
|
# When distributing Covered Code, include this CDDL HEADER in each
|
||||||
|
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||||
|
# If applicable, add the following below this CDDL HEADER, with the
|
||||||
|
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||||
|
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||||
|
#
|
||||||
|
# CDDL HEADER END
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
# Use is subject to license terms.
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
|
||||||
|
#
|
||||||
|
. $STF_SUITE/include/libtest.shlib
|
||||||
|
. $STF_SUITE/tests/functional/userquota/userquota_common.kshlib
|
||||||
|
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# DESCRIPTION:
|
||||||
|
# Check the basic function of defaultuserquota and defaultgroupquota
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# STRATEGY:
|
||||||
|
# 1. Set defaultuserquota and exceed the quota size
|
||||||
|
# 2. The write operation should fail with "Disk quota exceeded"
|
||||||
|
# 3. Set defaultgroupquota and exceed the quota size
|
||||||
|
# 4. The write operation should fail with "Disk quota exceeded"
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
|
function cleanup
|
||||||
|
{
|
||||||
|
cleanup_quota
|
||||||
|
}
|
||||||
|
|
||||||
|
log_onexit cleanup
|
||||||
|
|
||||||
|
log_assert "If write operation exceeds default{user|group}quota size, it will fail"
|
||||||
|
|
||||||
|
mkmount_writable $QFS
|
||||||
|
log_note "Check the defaultuserquota"
|
||||||
|
log_must zfs set defaultuserquota=$UQUOTA_SIZE $QFS
|
||||||
|
log_must user_run $QUSER1 mkfile $UQUOTA_SIZE $QFILE
|
||||||
|
sync_pool
|
||||||
|
log_mustnot user_run $QUSER1 mkfile 1 $OFILE
|
||||||
|
cleanup_quota
|
||||||
|
|
||||||
|
log_note "Check the defaultgroupquota"
|
||||||
|
log_must zfs set defaultgroupquota=$GQUOTA_SIZE $QFS
|
||||||
|
mkmount_writable $QFS
|
||||||
|
log_must user_run $QUSER1 mkfile $GQUOTA_SIZE $QFILE
|
||||||
|
sync_pool
|
||||||
|
log_mustnot user_run $QUSER1 mkfile 1 $OFILE
|
||||||
|
log_mustnot user_run $QUSER2 mkfile 1 $OFILE
|
||||||
|
cleanup_quota
|
||||||
|
|
||||||
|
log_pass "Write operation exceeded default{user|group}quota size, failed as expected"
|
|
@ -0,0 +1,95 @@
|
||||||
|
#!/bin/ksh -p
|
||||||
|
#
|
||||||
|
# CDDL HEADER START
|
||||||
|
#
|
||||||
|
# The contents of this file are subject to the terms of the
|
||||||
|
# Common Development and Distribution License (the "License").
|
||||||
|
# You may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||||
|
# or https://opensource.org/licenses/CDDL-1.0.
|
||||||
|
# See the License for the specific language governing permissions
|
||||||
|
# and limitations under the License.
|
||||||
|
#
|
||||||
|
# When distributing Covered Code, include this CDDL HEADER in each
|
||||||
|
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||||
|
# If applicable, add the following below this CDDL HEADER, with the
|
||||||
|
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||||
|
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||||
|
#
|
||||||
|
# CDDL HEADER END
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
# Use is subject to license terms.
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
|
||||||
|
#
|
||||||
|
|
||||||
|
. $STF_SUITE/include/libtest.shlib
|
||||||
|
. $STF_SUITE/tests/functional/userquota/userquota_common.kshlib
|
||||||
|
|
||||||
|
#
|
||||||
|
# DESCRIPTION:
|
||||||
|
# defaultuserquota and defaultgroupquota can be set during zpool or zfs creation"
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# STRATEGY:
|
||||||
|
# 1. Set defaultuserquota and defaultgroupquota via "zpool -O or zfs create -o"
|
||||||
|
#
|
||||||
|
|
||||||
|
verify_runnable "global"
|
||||||
|
|
||||||
|
function cleanup
|
||||||
|
{
|
||||||
|
if poolexists $TESTPOOL1; then
|
||||||
|
log_must zpool destroy $TESTPOOL1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -f $pool_vdev ]]; then
|
||||||
|
rm -f $pool_vdev
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
log_onexit cleanup
|
||||||
|
|
||||||
|
log_assert \
|
||||||
|
"default{user|group}quota can be set during {zpool|zfs} create"
|
||||||
|
|
||||||
|
typeset pool_vdev=$TEST_BASE_DIR/pool_dev.$$
|
||||||
|
|
||||||
|
log_must mkfile 500m $pool_vdev
|
||||||
|
|
||||||
|
if poolexists $TESTPOOL1; then
|
||||||
|
zpool destroy $TESTPOOL1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log_must zpool create \
|
||||||
|
-O defaultuserquota=$UQUOTA_SIZE \
|
||||||
|
-O defaultgroupquota=$GQUOTA_SIZE \
|
||||||
|
$TESTPOOL1 $pool_vdev
|
||||||
|
|
||||||
|
log_must eval "zfs list -r \
|
||||||
|
-o defaultuserquota,defaultgroupquota \
|
||||||
|
$TESTPOOL1 > /dev/null 2>&1"
|
||||||
|
|
||||||
|
log_must check_quota "defaultuserquota" $TESTPOOL1 "$UQUOTA_SIZE"
|
||||||
|
log_must check_quota "defaultgroupquota" $TESTPOOL1 "$GQUOTA_SIZE"
|
||||||
|
|
||||||
|
log_must zfs create \
|
||||||
|
-o defaultuserquota=$UQUOTA_SIZE \
|
||||||
|
-o defaultgroupquota=$GQUOTA_SIZE \
|
||||||
|
$TESTPOOL1/fs
|
||||||
|
|
||||||
|
log_must eval "zfs list -r \
|
||||||
|
-o defaultuserquota,defaultgroupquota \
|
||||||
|
$TESTPOOL1 > /dev/null 2>&1"
|
||||||
|
|
||||||
|
log_must check_quota "defaultuserquota" $TESTPOOL1/fs "$UQUOTA_SIZE"
|
||||||
|
log_must check_quota "defaultgroupquota" $TESTPOOL1/fs "$GQUOTA_SIZE"
|
||||||
|
|
||||||
|
log_pass \
|
||||||
|
"default{user|group}quota can be set during {zpool|zfs} create"
|
|
@ -0,0 +1,61 @@
|
||||||
|
#!/bin/ksh -p
|
||||||
|
#
|
||||||
|
# CDDL HEADER START
|
||||||
|
#
|
||||||
|
# The contents of this file are subject to the terms of the
|
||||||
|
# Common Development and Distribution License (the "License").
|
||||||
|
# You may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||||
|
# or https://opensource.org/licenses/CDDL-1.0.
|
||||||
|
# See the License for the specific language governing permissions
|
||||||
|
# and limitations under the License.
|
||||||
|
#
|
||||||
|
# When distributing Covered Code, include this CDDL HEADER in each
|
||||||
|
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||||
|
# If applicable, add the following below this CDDL HEADER, with the
|
||||||
|
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||||
|
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||||
|
#
|
||||||
|
# CDDL HEADER END
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
# Use is subject to license terms.
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
|
||||||
|
#
|
||||||
|
|
||||||
|
. $STF_SUITE/include/libtest.shlib
|
||||||
|
. $STF_SUITE/tests/functional/userquota/userquota_common.kshlib
|
||||||
|
|
||||||
|
#
|
||||||
|
# DESCRIPTION:
|
||||||
|
# Check the basic function of set/get defaultuserquota and defaultgroupquota on fs
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# STRATEGY:
|
||||||
|
# 1. Set defaultuserquota on fs and check output of zfs get
|
||||||
|
# 2. Set defaultgroupquota on fs and check output of zfs get
|
||||||
|
#
|
||||||
|
|
||||||
|
function cleanup
|
||||||
|
{
|
||||||
|
cleanup_quota
|
||||||
|
}
|
||||||
|
|
||||||
|
log_onexit cleanup
|
||||||
|
|
||||||
|
log_assert "Check the basic function of set/get default{user|group}quota on fs"
|
||||||
|
|
||||||
|
log_note "Check zfs {set|get} default{user|group}quota"
|
||||||
|
log_must zfs set defaultuserquota=$UQUOTA_SIZE $QFS
|
||||||
|
log_must check_quota "defaultuserquota" $QFS "$UQUOTA_SIZE"
|
||||||
|
|
||||||
|
log_must zfs set defaultgroupquota=$GQUOTA_SIZE $QFS
|
||||||
|
log_must check_quota "defaultgroupquota" $QFS "$GQUOTA_SIZE"
|
||||||
|
|
||||||
|
log_pass "Check the basic function of zfs {set|get} default{user|group}quota passed as expected"
|
|
@ -0,0 +1,71 @@
|
||||||
|
#!/bin/ksh -p
|
||||||
|
#
|
||||||
|
# CDDL HEADER START
|
||||||
|
#
|
||||||
|
# The contents of this file are subject to the terms of the
|
||||||
|
# Common Development and Distribution License (the "License").
|
||||||
|
# You may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||||
|
# or https://opensource.org/licenses/CDDL-1.0.
|
||||||
|
# See the License for the specific language governing permissions
|
||||||
|
# and limitations under the License.
|
||||||
|
#
|
||||||
|
# When distributing Covered Code, include this CDDL HEADER in each
|
||||||
|
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||||
|
# If applicable, add the following below this CDDL HEADER, with the
|
||||||
|
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||||
|
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||||
|
#
|
||||||
|
# CDDL HEADER END
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
# Use is subject to license terms.
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
|
||||||
|
#
|
||||||
|
|
||||||
|
. $STF_SUITE/include/libtest.shlib
|
||||||
|
. $STF_SUITE/tests/functional/userquota/userquota_common.kshlib
|
||||||
|
|
||||||
|
#
|
||||||
|
# DESCRIPTION:
|
||||||
|
# Check invalid parameter handling of zfs set default{user|group}quota
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# STRATEGY:
|
||||||
|
# 1. try to set invalid values with zfs set default{user|group}quota to fs
|
||||||
|
# 2. try to set valid values with zfs set default{user|group}quota to snapshots (an invalid operation)
|
||||||
|
#
|
||||||
|
|
||||||
|
function cleanup
|
||||||
|
{
|
||||||
|
datasetexists $snap_fs && destroy_dataset $snap_fs
|
||||||
|
|
||||||
|
log_must cleanup_quota
|
||||||
|
}
|
||||||
|
|
||||||
|
log_onexit cleanup
|
||||||
|
|
||||||
|
log_assert "Check invalid values for zfs set default{user|group}quota"
|
||||||
|
typeset snap_fs=$QFS@snap
|
||||||
|
|
||||||
|
log_must zfs snapshot $snap_fs
|
||||||
|
|
||||||
|
set -A sizes "100mfsd" "m0.12m" "GGM" "-1234-m" "123m-m"
|
||||||
|
|
||||||
|
for size in "${sizes[@]}"; do
|
||||||
|
log_note "can not set default{user|group}quota with invalid size parameter"
|
||||||
|
log_mustnot zfs set defaultuserquota=$size $QFS
|
||||||
|
log_mustnot zfs set defaultgroupquota=$size $QFS
|
||||||
|
done
|
||||||
|
|
||||||
|
log_note "can not set default{user|group}quota to snapshot $snap_fs"
|
||||||
|
log_mustnot zfs set defaultuserquota=100m $snap_fs
|
||||||
|
log_mustnot zfs set defaultgroupquota=100m $snap_fs
|
||||||
|
|
||||||
|
log_pass "Check invalid values for zfs set default{user|group}quota passed as expected"
|
|
@ -0,0 +1,75 @@
|
||||||
|
#!/bin/ksh -p
|
||||||
|
#
|
||||||
|
# CDDL HEADER START
|
||||||
|
#
|
||||||
|
# The contents of this file are subject to the terms of the
|
||||||
|
# Common Development and Distribution License (the "License").
|
||||||
|
# You may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||||
|
# or https://opensource.org/licenses/CDDL-1.0.
|
||||||
|
# See the License for the specific language governing permissions
|
||||||
|
# and limitations under the License.
|
||||||
|
#
|
||||||
|
# When distributing Covered Code, include this CDDL HEADER in each
|
||||||
|
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||||
|
# If applicable, add the following below this CDDL HEADER, with the
|
||||||
|
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||||
|
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||||
|
#
|
||||||
|
# CDDL HEADER END
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
# Use is subject to license terms.
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
|
||||||
|
#
|
||||||
|
|
||||||
|
. $STF_SUITE/include/libtest.shlib
|
||||||
|
. $STF_SUITE/tests/functional/userquota/userquota_common.kshlib
|
||||||
|
|
||||||
|
#
|
||||||
|
# DESCRIPTION:
|
||||||
|
#
|
||||||
|
# defaultuserquota/defaultgroupquota can be set beyond the fs quota
|
||||||
|
# defaultuserquota/defaultgroupquota can be set at a smaller size than its current usage.
|
||||||
|
#
|
||||||
|
# STRATEGY:
|
||||||
|
# 1. set quota to a fs and set a larger size of defaultuserquota and defaultgroupquota
|
||||||
|
# 2. write some data to the fs and set a smaller defaultuserquota and defaultgroupquota
|
||||||
|
#
|
||||||
|
|
||||||
|
function cleanup
|
||||||
|
{
|
||||||
|
log_must cleanup_quota
|
||||||
|
log_must zfs set quota=none $QFS
|
||||||
|
}
|
||||||
|
|
||||||
|
log_onexit cleanup
|
||||||
|
|
||||||
|
log_assert "Check set default{user|group}quota to larger than the quota size of a fs"
|
||||||
|
|
||||||
|
log_must zfs set quota=200m $QFS
|
||||||
|
log_must zfs set defaultuserquota="$UQUOTA_SIZE" $QFS
|
||||||
|
log_must zfs set defaultgroupquota="$GQUOTA_SIZE" $QFS
|
||||||
|
|
||||||
|
log_must check_quota "defaultuserquota" $QFS "$UQUOTA_SIZE"
|
||||||
|
log_must check_quota "defaultgroupquota" $QFS "$GQUOTA_SIZE"
|
||||||
|
|
||||||
|
log_note "write some data to the $QFS"
|
||||||
|
mkmount_writable $QFS
|
||||||
|
log_must user_run $QUSER1 mkfile 100000 $QFILE
|
||||||
|
sync_all_pools
|
||||||
|
|
||||||
|
log_note "set default{user|group}quota at a smaller size than current usage"
|
||||||
|
log_must zfs set defaultuserquota=90000 $QFS
|
||||||
|
log_must zfs set defaultgroupquota=90000 $QFS
|
||||||
|
|
||||||
|
log_must check_quota "defaultuserquota" $QFS 90000
|
||||||
|
log_must check_quota "defaultgroupquota" $QFS 90000
|
||||||
|
|
||||||
|
log_pass "set default{user|group}quota to larger than quota size of a fs passed as expected"
|
|
@ -0,0 +1,60 @@
|
||||||
|
#!/bin/ksh -p
|
||||||
|
#
|
||||||
|
# CDDL HEADER START
|
||||||
|
#
|
||||||
|
# The contents of this file are subject to the terms of the
|
||||||
|
# Common Development and Distribution License (the "License").
|
||||||
|
# You may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||||
|
# or https://opensource.org/licenses/CDDL-1.0.
|
||||||
|
# See the License for the specific language governing permissions
|
||||||
|
# and limitations under the License.
|
||||||
|
#
|
||||||
|
# When distributing Covered Code, include this CDDL HEADER in each
|
||||||
|
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||||
|
# If applicable, add the following below this CDDL HEADER, with the
|
||||||
|
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||||
|
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||||
|
#
|
||||||
|
# CDDL HEADER END
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
# Use is subject to license terms.
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
|
||||||
|
#
|
||||||
|
|
||||||
|
. $STF_SUITE/include/libtest.shlib
|
||||||
|
. $STF_SUITE/tests/functional/userquota/userquota_common.kshlib
|
||||||
|
|
||||||
|
#
|
||||||
|
# DESCRIPTION:
|
||||||
|
#
|
||||||
|
# zfs get all <fs> does print out defaultuserquota/defaultgroupquota
|
||||||
|
#
|
||||||
|
# STRATEGY:
|
||||||
|
# 1. set defaultuserquota and defaultgroupquota to a fs
|
||||||
|
# 2. check zfs get all fs
|
||||||
|
#
|
||||||
|
|
||||||
|
function cleanup
|
||||||
|
{
|
||||||
|
log_must cleanup_quota
|
||||||
|
}
|
||||||
|
|
||||||
|
log_onexit cleanup
|
||||||
|
|
||||||
|
log_assert "Check zfs get all will print out default{user|group}quota"
|
||||||
|
|
||||||
|
log_must zfs set defaultuserquota=50m $QFS
|
||||||
|
log_must zfs set defaultgroupquota=100m $QFS
|
||||||
|
|
||||||
|
log_must zfs get all $QFS | grep defaultuserquota
|
||||||
|
log_must zfs get all $QFS | grep defaultgroupquota
|
||||||
|
|
||||||
|
log_pass "zfs get all will print out default{user|group}quota"
|
|
@ -0,0 +1,89 @@
|
||||||
|
#!/bin/ksh -p
|
||||||
|
#
|
||||||
|
# CDDL HEADER START
|
||||||
|
#
|
||||||
|
# The contents of this file are subject to the terms of the
|
||||||
|
# Common Development and Distribution License (the "License").
|
||||||
|
# You may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||||
|
# or https://opensource.org/licenses/CDDL-1.0.
|
||||||
|
# See the License for the specific language governing permissions
|
||||||
|
# and limitations under the License.
|
||||||
|
#
|
||||||
|
# When distributing Covered Code, include this CDDL HEADER in each
|
||||||
|
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||||
|
# If applicable, add the following below this CDDL HEADER, with the
|
||||||
|
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||||
|
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||||
|
#
|
||||||
|
# CDDL HEADER END
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
# Use is subject to license terms.
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
|
||||||
|
#
|
||||||
|
|
||||||
|
. $STF_SUITE/include/libtest.shlib
|
||||||
|
. $STF_SUITE/tests/functional/userquota/userquota_common.kshlib
|
||||||
|
|
||||||
|
#
|
||||||
|
# DESCRIPTION:
|
||||||
|
# Check default{user|group}quota to snapshot such that:
|
||||||
|
# 1) can not set default{user|group}quota to snapshot directly
|
||||||
|
# 2) snapshot does not inherit the parent fs's default{user|group}quota
|
||||||
|
# (same behavior as Solaris)
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# STRATEGY:
|
||||||
|
# 1. create a snapshot of a fs
|
||||||
|
# 2. set the default{user|group}quota to snapshot and expect fail
|
||||||
|
# 3. set default{user|group}quota to fs and check the snapshot
|
||||||
|
# 4. reset default{user|group}quota to fs and check the snapshot's value
|
||||||
|
#
|
||||||
|
|
||||||
|
function cleanup
|
||||||
|
{
|
||||||
|
datasetexists $snap_fs && destroy_dataset $snap_fs
|
||||||
|
|
||||||
|
log_must cleanup_quota
|
||||||
|
}
|
||||||
|
|
||||||
|
log_onexit cleanup
|
||||||
|
|
||||||
|
log_assert "Check the snapshot's default{user|group}quota"
|
||||||
|
typeset snap_fs=$QFS@snap
|
||||||
|
|
||||||
|
log_must zfs set defaultuserquota=$UQUOTA_SIZE $QFS
|
||||||
|
log_must check_quota "defaultuserquota" $QFS "$UQUOTA_SIZE"
|
||||||
|
|
||||||
|
log_must zfs set defaultgroupquota=$GQUOTA_SIZE $QFS
|
||||||
|
log_must check_quota "defaultgroupquota" $QFS "$GQUOTA_SIZE"
|
||||||
|
|
||||||
|
log_must zfs snapshot $snap_fs
|
||||||
|
|
||||||
|
log_note "check the snapshot $snap_fs default{user|group}quota"
|
||||||
|
log_mustnot check_quota "defaultuserquota" $snap_fs "$UQUOTA_SIZE"
|
||||||
|
log_mustnot check_quota "defaultgroupquota" $snap_fs "$GQUOTA_SIZE"
|
||||||
|
|
||||||
|
log_note "set default{user|group}quota to $snap_fs should fail"
|
||||||
|
log_mustnot zfs set defaultuserquota=$SNAP_QUOTA $snap_fs
|
||||||
|
log_mustnot zfs set defaultgroupquota=$SNAP_QUOTA $snap_fs
|
||||||
|
|
||||||
|
log_note "change the parent filesystem's default{user|group}quota"
|
||||||
|
log_must zfs set defaultuserquota=$TEST_QUOTA $QFS
|
||||||
|
log_must zfs set defaultgroupquota=$TEST_QUOTA $QFS
|
||||||
|
|
||||||
|
log_must check_quota "defaultuserquota" $QFS $TEST_QUOTA
|
||||||
|
log_must check_quota "defaultgroupquota" $QFS $TEST_QUOTA
|
||||||
|
|
||||||
|
log_note "check the snapshot $snap_fs default{user|group}quota"
|
||||||
|
log_mustnot check_quota "defaultuserquota" $snap_fs "$UQUOTA_SIZE"
|
||||||
|
log_mustnot check_quota "defaultgroupquota" $snap_fs "$GQUOTA_SIZE"
|
||||||
|
|
||||||
|
log_pass "Check the snapshot's default{user|group}quota passed as expected"
|
|
@ -0,0 +1,77 @@
|
||||||
|
#!/bin/ksh -p
|
||||||
|
#
|
||||||
|
# CDDL HEADER START
|
||||||
|
#
|
||||||
|
# The contents of this file are subject to the terms of the
|
||||||
|
# Common Development and Distribution License (the "License").
|
||||||
|
# You may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||||
|
# or https://opensource.org/licenses/CDDL-1.0.
|
||||||
|
# See the License for the specific language governing permissions
|
||||||
|
# and limitations under the License.
|
||||||
|
#
|
||||||
|
# When distributing Covered Code, include this CDDL HEADER in each
|
||||||
|
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||||
|
# If applicable, add the following below this CDDL HEADER, with the
|
||||||
|
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||||
|
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||||
|
#
|
||||||
|
# CDDL HEADER END
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
# Use is subject to license terms.
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
|
||||||
|
#
|
||||||
|
|
||||||
|
. $STF_SUITE/include/libtest.shlib
|
||||||
|
. $STF_SUITE/tests/functional/userquota/userquota_common.kshlib
|
||||||
|
|
||||||
|
#
|
||||||
|
# DESCRIPTION:
|
||||||
|
# Check defaultuserquota and defaultgroupquota being exceeded at the same time
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# STRATEGY:
|
||||||
|
# 1. Set defaultuserquota and defaultgroupquota to a fs
|
||||||
|
# 2. write to exceed the defaultuserquota size to check the result
|
||||||
|
# 3. unset defaultuserquota
|
||||||
|
# 4. write (as a different user) to exceed the defaultgroupquota size to check the result
|
||||||
|
#
|
||||||
|
|
||||||
|
function cleanup
|
||||||
|
{
|
||||||
|
cleanup_quota
|
||||||
|
}
|
||||||
|
|
||||||
|
log_onexit cleanup
|
||||||
|
|
||||||
|
log_assert "write in excess of any default{user|group}quota size fails"
|
||||||
|
|
||||||
|
log_note "write to $QFS to make it exceed defaultuserquota ($GQUOTA_SIZE)"
|
||||||
|
log_must zfs set defaultuserquota=$GQUOTA_SIZE $QFS
|
||||||
|
log_must zfs set defaultgroupquota=$GQUOTA_SIZE $QFS
|
||||||
|
|
||||||
|
mkmount_writable $QFS
|
||||||
|
log_must user_run $QUSER1 mkfile $GQUOTA_SIZE $QFILE
|
||||||
|
sync_pool
|
||||||
|
|
||||||
|
log_must eval "zfs get -p userused@$QUSER1 $QFS >/dev/null 2>&1"
|
||||||
|
log_must eval "zfs get -p groupused@$GROUPUSED $QFS >/dev/null 2>&1"
|
||||||
|
|
||||||
|
log_mustnot user_run $QUSER1 mkfile 1 $OFILE
|
||||||
|
|
||||||
|
log_must zfs set defaultuserquota=none $QFS
|
||||||
|
|
||||||
|
log_note "write to $QFS as $QUSER2 to make it exceed defaultgroupquota"
|
||||||
|
log_mustnot user_run $QUSER2 mkfile 1 $QFILE
|
||||||
|
|
||||||
|
log_must eval "zfs get -p userused@$QUSER1 $QFS >/dev/null 2>&1"
|
||||||
|
log_must eval "zfs get -p userused@$QUSER2 $QFS >/dev/null 2>&1"
|
||||||
|
log_must eval "zfs get -p groupused@$GROUPUSED $QFS >/dev/null 2>&1"
|
||||||
|
|
||||||
|
log_pass "write in excess of any default{user|group}quota size failed as expected"
|
|
@ -0,0 +1,132 @@
|
||||||
|
#!/bin/ksh -p
|
||||||
|
#
|
||||||
|
# CDDL HEADER START
|
||||||
|
#
|
||||||
|
# The contents of this file are subject to the terms of the
|
||||||
|
# Common Development and Distribution License (the "License").
|
||||||
|
# You may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||||
|
# or https://opensource.org/licenses/CDDL-1.0.
|
||||||
|
# See the License for the specific language governing permissions
|
||||||
|
# and limitations under the License.
|
||||||
|
#
|
||||||
|
# When distributing Covered Code, include this CDDL HEADER in each
|
||||||
|
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||||
|
# If applicable, add the following below this CDDL HEADER, with the
|
||||||
|
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||||
|
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||||
|
#
|
||||||
|
# CDDL HEADER END
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
# Use is subject to license terms.
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
|
||||||
|
#
|
||||||
|
|
||||||
|
. $STF_SUITE/include/libtest.shlib
|
||||||
|
. $STF_SUITE/tests/functional/userquota/userquota_common.kshlib
|
||||||
|
|
||||||
|
#
|
||||||
|
# DESCRIPTION:
|
||||||
|
# the defaultuserquota and defaultgroupquota will not change during zfs actions, such as
|
||||||
|
# snapshot,clone,rename,upgrade,send,receive.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# STRATEGY:
|
||||||
|
# 1. Create a pool, and create fs with preset default user,group quota
|
||||||
|
# 2. Check set default user|group quota via zfs snapshot|clone|list -o
|
||||||
|
# 3. Check the default user|group quota can not change during zfs rename|upgrade|promote
|
||||||
|
# 4. Check the default user|group quota can not change during zfs clone
|
||||||
|
# 5. Check the default user|group quota can not change during zfs send/receive
|
||||||
|
#
|
||||||
|
|
||||||
|
function cleanup
|
||||||
|
{
|
||||||
|
for ds in $TESTPOOL/fs $TESTPOOL/fs-rename $TESTPOOL/fs-clone; do
|
||||||
|
datasetexists $ds && destroy_dataset $ds -rRf
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
log_onexit cleanup
|
||||||
|
|
||||||
|
log_assert \
|
||||||
|
"the default{user|group}quota don't change during zfs actions"
|
||||||
|
|
||||||
|
cleanup
|
||||||
|
|
||||||
|
log_must zfs create \
|
||||||
|
-o defaultuserquota=$UQUOTA_SIZE \
|
||||||
|
-o defaultgroupquota=$GQUOTA_SIZE \
|
||||||
|
$TESTPOOL/fs
|
||||||
|
|
||||||
|
log_must zfs snapshot $TESTPOOL/fs@snap
|
||||||
|
log_must eval "zfs list -r \
|
||||||
|
-o defaultuserquota,defaultgroupquota \
|
||||||
|
$TESTPOOL >/dev/null 2>&1"
|
||||||
|
|
||||||
|
log_mustnot check_quota "defaultuserquota" $TESTPOOL/fs@snap "$UQUOTA_SIZE"
|
||||||
|
log_mustnot check_quota "defaultgroupquota" $TESTPOOL/fs@snap "$GQUOTA_SIZE"
|
||||||
|
|
||||||
|
log_note "clone fs gets its parent's default{user|group}quota initially"
|
||||||
|
log_must zfs clone \
|
||||||
|
$TESTPOOL/fs@snap $TESTPOOL/fs-clone
|
||||||
|
|
||||||
|
log_must eval "zfs list -r \
|
||||||
|
-o defaultuserquota,defaultgroupquota \
|
||||||
|
$TESTPOOL >/dev/null 2>&1"
|
||||||
|
|
||||||
|
log_must check_quota "defaultuserquota" $TESTPOOL/fs-clone "$UQUOTA_SIZE"
|
||||||
|
log_must check_quota "defaultgroupquota" $TESTPOOL/fs-clone "$GQUOTA_SIZE"
|
||||||
|
|
||||||
|
log_must eval "zfs list \
|
||||||
|
-o defaultuserquota,defaultgroupquota \
|
||||||
|
$TESTPOOL/fs-clone >/dev/null 2>&1"
|
||||||
|
|
||||||
|
log_note "zfs promote can not change the previously set default{user|group}quota"
|
||||||
|
log_must zfs promote $TESTPOOL/fs-clone
|
||||||
|
|
||||||
|
log_must eval "zfs list -r \
|
||||||
|
-o defaultuserquota,defaultgroupquota \
|
||||||
|
$TESTPOOL >/dev/null 2>&1"
|
||||||
|
|
||||||
|
log_must check_quota "defaultuserquota" $TESTPOOL/fs-clone "$UQUOTA_SIZE"
|
||||||
|
log_must check_quota "defaultgroupquota" $TESTPOOL/fs-clone "$GQUOTA_SIZE"
|
||||||
|
|
||||||
|
log_note "zfs send receive can not change the previously set default{user|group}quota"
|
||||||
|
log_must zfs send $TESTPOOL/fs-clone@snap | zfs receive $TESTPOOL/fs-rev
|
||||||
|
|
||||||
|
log_must eval "zfs list -r \
|
||||||
|
-o defaultuserquota,defaultgroupquota \
|
||||||
|
$TESTPOOL >/dev/null 2>&1"
|
||||||
|
|
||||||
|
log_must check_quota "defaultuserquota" $TESTPOOL/fs-rev "$UQUOTA_SIZE"
|
||||||
|
log_must check_quota "defaultgroupquota" $TESTPOOL/fs-rev "$GQUOTA_SIZE"
|
||||||
|
|
||||||
|
log_note "zfs rename can not change the previously set default{user|group}quota"
|
||||||
|
log_must zfs rename $TESTPOOL/fs-rev $TESTPOOL/fs-rename
|
||||||
|
|
||||||
|
log_must eval "zfs list -r \
|
||||||
|
-o defaultuserquota,defaultgroupquota \
|
||||||
|
$TESTPOOL >/dev/null 2>&1"
|
||||||
|
|
||||||
|
log_must check_quota "defaultuserquota" $TESTPOOL/fs-rename "$UQUOTA_SIZE"
|
||||||
|
log_must check_quota "defaultgroupquota" $TESTPOOL/fs-rename "$GQUOTA_SIZE"
|
||||||
|
|
||||||
|
log_note "zfs upgrade can not change the previously set default{user|group}quota"
|
||||||
|
log_must zfs upgrade $TESTPOOL/fs-rename
|
||||||
|
|
||||||
|
log_must eval "zfs list -r \
|
||||||
|
-o defaultuserquota,defaultgroupquota \
|
||||||
|
$TESTPOOL >/dev/null 2>&1"
|
||||||
|
|
||||||
|
log_must check_quota "defaultuserquota" $TESTPOOL/fs-rename "$UQUOTA_SIZE"
|
||||||
|
log_must check_quota "defaultgroupquota" $TESTPOOL/fs-rename "$GQUOTA_SIZE"
|
||||||
|
|
||||||
|
log_pass \
|
||||||
|
"the default{user|group}quota don't change during zfs actions"
|
|
@ -0,0 +1,64 @@
|
||||||
|
#!/bin/ksh -p
|
||||||
|
#
|
||||||
|
# CDDL HEADER START
|
||||||
|
#
|
||||||
|
# The contents of this file are subject to the terms of the
|
||||||
|
# Common Development and Distribution License (the "License").
|
||||||
|
# You may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||||
|
# or https://opensource.org/licenses/CDDL-1.0.
|
||||||
|
# See the License for the specific language governing permissions
|
||||||
|
# and limitations under the License.
|
||||||
|
#
|
||||||
|
# When distributing Covered Code, include this CDDL HEADER in each
|
||||||
|
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||||
|
# If applicable, add the following below this CDDL HEADER, with the
|
||||||
|
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||||
|
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||||
|
#
|
||||||
|
# CDDL HEADER END
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
# Use is subject to license terms.
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
|
||||||
|
#
|
||||||
|
|
||||||
|
. $STF_SUITE/include/libtest.shlib
|
||||||
|
. $STF_SUITE/tests/functional/userquota/userquota_common.kshlib
|
||||||
|
|
||||||
|
#
|
||||||
|
# DESCRIPTION:
|
||||||
|
# defaultuserquota and defaultgroupquota can not be set against snapshot
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# STRATEGY:
|
||||||
|
# 1. Set defaultuserquota on snap
|
||||||
|
# 2. Set defaultgroupquota on snap
|
||||||
|
#
|
||||||
|
|
||||||
|
function cleanup
|
||||||
|
{
|
||||||
|
cleanup_quota
|
||||||
|
|
||||||
|
datasetexists $snap_fs && destroy_dataset $snap_fs
|
||||||
|
}
|
||||||
|
|
||||||
|
log_onexit cleanup
|
||||||
|
|
||||||
|
typeset snap_fs=$QFS@snap
|
||||||
|
log_assert "Check setting default{user|group}quota on snapshot"
|
||||||
|
|
||||||
|
log_note "Check can not set default{user|group}quota on snapshot"
|
||||||
|
log_must zfs snapshot $snap_fs
|
||||||
|
|
||||||
|
log_mustnot zfs set defaultuserquota=$UQUOTA_SIZE $snap_fs
|
||||||
|
|
||||||
|
log_mustnot zfs set defaultgroupquota=$GQUOTA_SIZE $snap_fs
|
||||||
|
|
||||||
|
log_pass "Check setting default{user|group}quota on snapshot fails as expected"
|
Loading…
Reference in New Issue