diff options
Diffstat (limited to 'tests/bugs/quota')
-rw-r--r-- | tests/bugs/quota/afr-quota-xattr-mdata-heal.t | 138 | ||||
-rw-r--r-- | tests/bugs/quota/bug-1023974.t | 35 | ||||
-rw-r--r-- | tests/bugs/quota/bug-1035576.t | 52 | ||||
-rw-r--r-- | tests/bugs/quota/bug-1038598.t | 80 | ||||
-rwxr-xr-x | tests/bugs/quota/bug-1040423.t | 72 | ||||
-rwxr-xr-x | tests/bugs/quota/bug-1049323.t | 64 | ||||
-rw-r--r-- | tests/bugs/quota/bug-1087198.t | 77 | ||||
-rw-r--r-- | tests/bugs/quota/bug-1100050.t | 25 | ||||
-rwxr-xr-x | tests/bugs/quota/bug-1104692.t | 32 |
9 files changed, 575 insertions, 0 deletions
diff --git a/tests/bugs/quota/afr-quota-xattr-mdata-heal.t b/tests/bugs/quota/afr-quota-xattr-mdata-heal.t new file mode 100644 index 00000000000..b7a15a31f66 --- /dev/null +++ b/tests/bugs/quota/afr-quota-xattr-mdata-heal.t @@ -0,0 +1,138 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1} +TEST $CLI volume start $V0 +TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0 +TEST $CLI volume quota $V0 enable +TEST $CLI volume quota $V0 limit-usage / 1MB +TEST mkdir $M0/d +TEST $CLI volume quota $V0 limit-usage /d 1MB +TEST touch $M0/d/a +echo abc > $M0/d/a +#Set the acl xattrs directly on backend, for some reason on mount it gives error +acl_access_val="0x0200000001000600ffffffff04000400ffffffff10000400ffffffff20000400ffffffff" +acl_file_val="0x0000000400000001ffffffff0006000000000004ffffffff0004000000000010ffffffff0004000000000020ffffffff00040000" +TEST setfattr -n system.posix_acl_access -v $acl_access_val $B0/${V0}0/d +TEST setfattr -n trusted.SGI_ACL_FILE -v $acl_file_val $B0/${V0}0/d +TEST setfattr -n system.posix_acl_access -v $acl_access_val $B0/${V0}1/d +TEST setfattr -n trusted.SGI_ACL_FILE -v $acl_file_val $B0/${V0}1/d +TEST setfattr -n trusted.foo -v "baz" $M0/d +TEST setfattr -n trusted.foo -v "baz" $M0/d/a +TEST setfattr -n trusted.foo1 -v "baz1" $M0/d +TEST setfattr -n trusted.foo1 -v "baz1" $M0/d/a +TEST setfattr -n trusted.foo3 -v "unchanged" $M0/d +TEST setfattr -n trusted.foo3 -v "unchanged" $M0/d/a + +TEST kill_brick $V0 $H0 $B0/${V0}0 +#Induce metadata self-heal +TEST setfattr -n trusted.foo -v "bar" $M0/d +TEST setfattr -n trusted.foo -v "bar" $M0/d/a +TEST setfattr -x trusted.foo1 $M0/d +TEST setfattr -x trusted.foo1 $M0/d/a +TEST setfattr -n trusted.foo2 -v "bar2" $M0/d +TEST setfattr -n trusted.foo2 -v "bar2" $M0/d/a +d_quota_contri=$(getfattr -d -m . -e hex $B0/${V0}1/d | grep -E "trusted.glusterfs.quota.*.contri") +d_quota_dirty=$(getfattr -d -m . -e hex $B0/${V0}1/d | grep -E "trusted.glusterfs.quota.dirty") +d_quota_limit=$(getfattr -d -m . -e hex $B0/${V0}1/d | grep -E "trusted.glusterfs.quota.limit-set") +d_quota_size=$(getfattr -d -m . -e hex $B0/${V0}1/d | grep -E "trusted.glusterfs.quota.size") + +a_pgfid=$(getfattr -d -m . -e hex $B0/${V0}1/d/a | grep -E "trusted.pgfid.") + +#Change internal xattrs in the backend, later check that they are not healed +TEST setfattr -n trusted.glusterfs.quota.00000000-0000-0000-0000-000000000001.contri -v 0x0000000000000400 $B0/${V0}0/d +TEST setfattr -n trusted.glusterfs.quota.dirty -v 0x0000000000000400 $B0/${V0}0/d +TEST setfattr -n trusted.glusterfs.quota.limit-set -v 0x0000000000000400 $B0/${V0}0/d #This will be healed, this is external xattr +TEST setfattr -n trusted.glusterfs.quota.size -v 0x0000000000000400 $B0/${V0}0/d +TEST setfattr -n $(echo $a_pgfid | cut -f1 -d'=') -v "orphan" $B0/${V0}0/d/a + +TEST $CLI volume set $V0 cluster.self-heal-daemon on +TEST $CLI volume start $V0 force +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Y" glustershd_up_status +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 0 +EXPECT_WITHIN $HEAL_TIMEOUT "0" afr_get_pending_heal_count $V0 + +#Check external xattrs match +EXPECT "bar" echo $(getfattr -d -m. -e text $B0/${V0}0/d | grep trusted.foo) +EXPECT "bar" echo $(getfattr -d -m. -e text $B0/${V0}0/d/a | grep trusted.foo) +TEST ! getfattr -n trusted.foo1 $B0/${V0}0/d +TEST ! getfattr -n trusted.foo1 $B0/${V0}0/d/a +EXPECT "unchanged" echo $(getfattr -d -m. -e text $B0/${V0}0/d | grep trusted.foo3) +EXPECT "unchanged" echo $(getfattr -d -m. -e text $B0/${V0}0/d/a | grep trusted.foo3) +EXPECT "bar2" echo $(getfattr -d -m. -e text $B0/${V0}0/d | grep trusted.foo2) +EXPECT "bar2" echo $(getfattr -d -m. -e text $B0/${V0}0/d/a | grep trusted.foo2) +EXPECT "$d_quota_limit" echo $(getfattr -d -m . -e hex $B0/${V0}0/d | grep "trusted.glusterfs.quota.limit-set") + +EXPECT "bar" echo $(getfattr -d -m. -e text $B0/${V0}1/d | grep trusted.foo) +EXPECT "bar" echo $(getfattr -d -m. -e text $B0/${V0}1/d/a | grep trusted.foo) +TEST ! getfattr -n trusted.foo1 $B0/${V0}1/d +TEST ! getfattr -n trusted.foo1 $B0/${V0}1/d/a +EXPECT "unchanged" echo $(getfattr -d -m. -e text $B0/${V0}1/d | grep trusted.foo3) +EXPECT "unchanged" echo $(getfattr -d -m. -e text $B0/${V0}1/d/a | grep trusted.foo3) +EXPECT "bar2" echo $(getfattr -d -m. -e text $B0/${V0}1/d | grep trusted.foo2) +EXPECT "bar2" echo $(getfattr -d -m. -e text $B0/${V0}1/d/a | grep trusted.foo2) +EXPECT "$d_quota_limit" echo $(getfattr -d -m . -e hex $B0/${V0}1/d | grep "trusted.glusterfs.quota.limit-set") + +#Test that internal xattrs on B0 are not healed +EXPECT 0x0000000000000400 echo $(getfattr -d -m. -e hex $B0/${V0}0/d | grep trusted.glusterfs.quota.00000000-0000-0000-0000-000000000001.contri) +EXPECT 0x0000000000000400 echo $(getfattr -d -m. -e hex $B0/${V0}0/d | grep trusted.glusterfs.quota.dirty) +EXPECT "$d_quota_limit" echo $(getfattr -d -m. -e hex $B0/${V0}0/d | grep trusted.glusterfs.quota.limit-set) #This will be healed, this is external xattr +EXPECT 0x0000000000000400 echo $(getfattr -d -m. -e hex $B0/${V0}0/d | grep trusted.glusterfs.quota.size) +EXPECT "$acl_access_val" echo $(getfattr -d -m. -e hex $B0/${V0}0/d | grep system.posix_acl_access) +EXPECT "$acl_file_val" echo $(getfattr -d -m. -e hex $B0/${V0}0/d | grep trusted.SGI_ACL_FILE) +EXPECT "orphan" echo $(getfattr -d -m. -e text $B0/${V0}0/d/a | grep $(echo $a_pgfid | cut -f1 -d'=')) + +#Test that xattrs didn't go bad in source +EXPECT "$d_quota_contri" echo $(getfattr -d -m . -e hex $B0/${V0}1/d | grep -E "trusted.glusterfs.quota.*.contri") +EXPECT "$d_quota_dirty" echo $(getfattr -d -m . -e hex $B0/${V0}1/d | grep -E "trusted.glusterfs.quota.dirty") +EXPECT "$d_quota_limit" echo $(getfattr -d -m . -e hex $B0/${V0}1/d | grep -E "trusted.glusterfs.quota.limit-set") +EXPECT "$d_quota_size" echo $(getfattr -d -m . -e hex $B0/${V0}1/d | grep -E "trusted.glusterfs.quota.size") +EXPECT "$a_pgfid" echo $(getfattr -d -m . -e hex $B0/${V0}1/d/a | grep -E "trusted.pgfid.") +EXPECT "$acl_access_val" echo $(getfattr -d -m. -e hex $B0/${V0}1/d | grep system.posix_acl_access) +EXPECT "$acl_file_val" echo $(getfattr -d -m. -e hex $B0/${V0}1/d | grep trusted.SGI_ACL_FILE) + +#Do a lookup and it shouldn't trigger metadata self-heal and heal xattrs +EXPECT "bar" echo $(getfattr -d -m. -e text $B0/${V0}0/d | grep trusted.foo) +EXPECT "bar" echo $(getfattr -d -m. -e text $B0/${V0}0/d/a | grep trusted.foo) +TEST ! getfattr -n trusted.foo1 $B0/${V0}0/d +TEST ! getfattr -n trusted.foo1 $B0/${V0}0/d/a +EXPECT "unchanged" echo $(getfattr -d -m. -e text $B0/${V0}0/d | grep trusted.foo3) +EXPECT "unchanged" echo $(getfattr -d -m. -e text $B0/${V0}0/d/a | grep trusted.foo3) +EXPECT "bar2" echo $(getfattr -d -m. -e text $B0/${V0}0/d | grep trusted.foo2) +EXPECT "bar2" echo $(getfattr -d -m. -e text $B0/${V0}0/d/a | grep trusted.foo2) +EXPECT "$d_quota_limit" echo $(getfattr -d -m . -e hex $B0/${V0}0/d | grep "trusted.glusterfs.quota.limit-set") + +EXPECT "bar" echo $(getfattr -d -m. -e text $B0/${V0}1/d | grep trusted.foo) +EXPECT "bar" echo $(getfattr -d -m. -e text $B0/${V0}1/d/a | grep trusted.foo) +TEST ! getfattr -n trusted.foo1 $B0/${V0}1/d +TEST ! getfattr -n trusted.foo1 $B0/${V0}1/d/a +EXPECT "unchanged" echo $(getfattr -d -m. -e text $B0/${V0}1/d | grep trusted.foo3) +EXPECT "unchanged" echo $(getfattr -d -m. -e text $B0/${V0}1/d/a | grep trusted.foo3) +EXPECT "bar2" echo $(getfattr -d -m. -e text $B0/${V0}1/d | grep trusted.foo2) +EXPECT "bar2" echo $(getfattr -d -m. -e text $B0/${V0}1/d/a | grep trusted.foo2) +EXPECT "$d_quota_limit" echo $(getfattr -d -m . -e hex $B0/${V0}1/d | grep "trusted.glusterfs.quota.limit-set") + +#Test that internal xattrs on B0 are not healed +EXPECT 0x0000000000000400 echo $(getfattr -d -m. -e hex $B0/${V0}0/d | grep trusted.glusterfs.quota.00000000-0000-0000-0000-000000000001.contri) +EXPECT 0x0000000000000400 echo $(getfattr -d -m. -e hex $B0/${V0}0/d | grep trusted.glusterfs.quota.dirty) +EXPECT "$d_quota_limit" echo $(getfattr -d -m. -e hex $B0/${V0}0/d | grep trusted.glusterfs.quota.limit-set) #This will be healed, this is external xattr +EXPECT 0x0000000000000400 echo $(getfattr -d -m. -e hex $B0/${V0}0/d | grep trusted.glusterfs.quota.size) +EXPECT "orphan" echo $(getfattr -d -m. -e text $B0/${V0}0/d/a | grep $(echo $a_pgfid | cut -f1 -d'=')) + +#Test that xattrs didn't go bad in source +EXPECT "$d_quota_contri" echo $(getfattr -d -m . -e hex $B0/${V0}1/d | grep -E "trusted.glusterfs.quota.*.contri") +EXPECT "$d_quota_dirty" echo $(getfattr -d -m . -e hex $B0/${V0}1/d | grep -E "trusted.glusterfs.quota.dirty") +EXPECT "$d_quota_limit" echo $(getfattr -d -m . -e hex $B0/${V0}1/d | grep -E "trusted.glusterfs.quota.limit-set") +EXPECT "$d_quota_size" echo $(getfattr -d -m . -e hex $B0/${V0}1/d | grep -E "trusted.glusterfs.quota.size") +EXPECT "$a_pgfid" echo $(getfattr -d -m . -e hex $B0/${V0}1/d/a | grep -E "trusted.pgfid.") + +EXPECT "$acl_access_val" echo $(getfattr -d -m. -e hex $B0/${V0}0/d | grep system.posix_acl_access) +EXPECT "$acl_file_val" echo $(getfattr -d -m. -e hex $B0/${V0}0/d | grep trusted.SGI_ACL_FILE) +EXPECT "$acl_access_val" echo $(getfattr -d -m. -e hex $B0/${V0}1/d | grep system.posix_acl_access) +EXPECT "$acl_file_val" echo $(getfattr -d -m. -e hex $B0/${V0}1/d | grep trusted.SGI_ACL_FILE) +cleanup diff --git a/tests/bugs/quota/bug-1023974.t b/tests/bugs/quota/bug-1023974.t new file mode 100644 index 00000000000..017a6decf88 --- /dev/null +++ b/tests/bugs/quota/bug-1023974.t @@ -0,0 +1,35 @@ +#!/bin/bash + +# This regression test tries to ensure renaming a directory with content, and +# no limit set, is accounted properly, when moved into a directory with quota +# limit set. + +. $(dirname $0)/../../include.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd; +TEST $CLI volume info; + +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{1,2,3,4,5,6}; +TEST $CLI volume start $V0; + +TEST $CLI volume quota $V0 enable; + +TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 $M0; + +TEST mkdir -p $M0/1/2; +TEST $CLI volume quota $V0 limit-usage /1/2 100MB 70%; +TEST $CLI volume quota $V0 hard-timeout 0 +TEST $CLI volume quota $V0 soft-timeout 0 + +#The corresponding write(3) should fail with EDQUOT ("Disk quota exceeded") +TEST ! dd if=/dev/urandom of=$M0/1/2/file bs=1024k count=102; +TEST mkdir -p $M0/1/3; +TEST dd if=/dev/urandom of=$M0/1/3/file bs=1024k count=102; + +#The corresponding rename(3) should fail with EDQUOT ("Disk quota exceeded") +TEST ! mv $M0/1/3/ $M0/1/2/3_mvd; + +cleanup; diff --git a/tests/bugs/quota/bug-1035576.t b/tests/bugs/quota/bug-1035576.t new file mode 100644 index 00000000000..dd4f499d98e --- /dev/null +++ b/tests/bugs/quota/bug-1035576.t @@ -0,0 +1,52 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +#This script tests that self-heal of limit-set xattr is happening on a directory +#but self-heal of quota.size xattr is not happening + +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1} +TEST $CLI volume start $V0 +#Lets disable perf-xls so that lookup would reach afr +TEST $CLI volume set $V0 performance.quick-read off +TEST $CLI volume set $V0 performance.io-cache off +TEST $CLI volume set $V0 performance.write-behind off +TEST $CLI volume set $V0 performance.stat-prefetch off +TEST $CLI volume set $V0 performance.read-ahead off +TEST $CLI volume set $V0 background-self-heal-count 0 +TEST $CLI volume set $V0 self-heal-daemon off +TEST $CLI volume quota $V0 enable + +TEST kill_brick $V0 $H0 $B0/${V0}0 +TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0 +cd $M0 +TEST mkdir $M0/a +TEST $CLI volume quota $V0 limit-usage /a 1GB +echo abc > $M0/a/f +$CLI volume start $V0 force +EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 0 +quota_limit_val1=$(get_hex_xattr trusted.glusterfs.quota.limit-set $B0/${V0}1/a) +quota_size_val1=$(get_hex_xattr trusted.glusterfs.quota.size $B0/${V0}1/a) + +#Trigger entry,metadata self-heal +TEST ls $M0/a + +quota_limit_val0=$(get_hex_xattr trusted.glusterfs.quota.limit-set $B0/${V0}0/a) +quota_size_val0=$(get_hex_xattr trusted.glusterfs.quota.size $B0/${V0}0/a) + +#Test that limit-set xattr is healed +TEST [ $quota_limit_val0 == $quota_limit_val1 ] + +#Only entry, metadata self-heal is done quota size value should not be same +TEST [ $quota_size_val0 != $quota_size_val1 ] +TEST cat $M0/a/f + +#Now that data self-heal is done quota size value should be same +quota_size_val0=$(get_hex_xattr trusted.glusterfs.quota.size $B0/${V0}0/a) +TEST [ $quota_size_val0 == $quota_size_val1 ] +cleanup diff --git a/tests/bugs/quota/bug-1038598.t b/tests/bugs/quota/bug-1038598.t new file mode 100644 index 00000000000..c51bc470ce1 --- /dev/null +++ b/tests/bugs/quota/bug-1038598.t @@ -0,0 +1,80 @@ +#!/bin/bash +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume info; + +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{1,2}; + +function hard_limit() +{ + local QUOTA_PATH=$1; + $CLI volume quota $V0 list $QUOTA_PATH | grep "$QUOTA_PATH" | awk '{print $2}' +} + +function soft_limit() +{ + local QUOTA_PATH=$1; + $CLI volume quota $V0 list $QUOTA_PATH | grep "$QUOTA_PATH" | awk '{print $3}' +} + +function usage() +{ + local QUOTA_PATH=$1; + $CLI volume quota $V0 list $QUOTA_PATH | grep "$QUOTA_PATH" | awk '{print $4}' +} + +function sl_exceeded() +{ + local QUOTA_PATH=$1; + $CLI volume quota $V0 list $QUOTA_PATH | grep "$QUOTA_PATH" | awk '{print $6}' +} + +function hl_exceeded() +{ + local QUOTA_PATH=$1; + $CLI volume quota $V0 list $QUOTA_PATH | grep "$QUOTA_PATH" | awk '{print $7}' + +} + +EXPECT "$V0" volinfo_field $V0 'Volume Name'; +EXPECT 'Created' volinfo_field $V0 'Status'; +EXPECT '2' brick_count $V0 + +TEST $CLI volume start $V0; +EXPECT 'Started' volinfo_field $V0 'Status'; + +TEST $CLI volume quota $V0 enable +sleep 5 + +TEST glusterfs -s $H0 --volfile-id $V0 $M0; + +TEST mkdir -p $M0/test_dir +TEST $CLI volume quota $V0 limit-usage /test_dir 10MB 50 + +EXPECT "10.0MB" hard_limit "/test_dir"; +EXPECT "50%" soft_limit "/test_dir"; + +TEST dd if=/dev/zero of=$M0/test_dir/file1.txt bs=1024k count=4 +EXPECT "4.0MB" usage "/test_dir"; +EXPECT 'No' sl_exceeded "/test_dir"; +EXPECT 'No' hl_exceeded "/test_dir"; + +TEST dd if=/dev/zero of=$M0/test_dir/file1.txt bs=1024k count=6 +EXPECT "6.0MB" usage "/test_dir"; +EXPECT 'Yes' sl_exceeded "/test_dir"; +EXPECT 'No' hl_exceeded "/test_dir"; + +#set timeout to 0 so that quota gets enforced without any lag +TEST $CLI volume set $V0 features.hard-timeout 0 +TEST $CLI volume set $V0 features.soft-timeout 0 + +TEST ! dd if=/dev/zero of=$M0/test_dir/file1.txt bs=1024k count=15 +EXPECT 'Yes' sl_exceeded "/test_dir"; +EXPECT 'Yes' hl_exceeded "/test_dir"; + +cleanup; diff --git a/tests/bugs/quota/bug-1040423.t b/tests/bugs/quota/bug-1040423.t new file mode 100755 index 00000000000..4e7b5642c94 --- /dev/null +++ b/tests/bugs/quota/bug-1040423.t @@ -0,0 +1,72 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup + +function _init() { +# Start glusterd +TEST glusterd; +TEST pidof glusterd; +TEST $CLI volume info; + +# Lets create volume +TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2}; + +## Verify volume is created +EXPECT "$V0" volinfo_field $V0 'Volume Name'; +EXPECT 'Created' volinfo_field $V0 'Status'; + +#Start volume and verify +TEST $CLI volume start $V0; +EXPECT 'Started' volinfo_field $V0 'Status'; +TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 $M0 + +#Enable Quota +TEST $CLI volume quota $V0 enable + +#As quotad consumes some time to connect to brick process we invoke sleep +sleep 10; + +#set limit of 1GB of quota on root +TEST $CLI volume quota $V0 limit-usage / 1GB +} + +function get_hardlimit() +{ + VOLUME=$1 + + $CLI volume quota $VOLUME list | tail -1 | sed "s/ \{1,\}/ /g" | + cut -d' ' -f 2 +} + +function check_fattrs { + +touch $M0/file1; + +#This confirms that pgfid is also filtered +TEST ! "getfattr -d -e hex -m . $M0/file1 | grep pgfid "; + +#just check for quota xattr are visible or not +TEST ! "getfattr -d -e hex -m . $M0 | grep quota"; + +#setfattr should fail +TEST ! setfattr -n trusted.glusterfs.quota.limit-set -v 10 $M0; + +#remove xattr should fail +TEST ! setfattr -x trusted.glusterfs.quota.limit-set $M0; + +#check if list command still shows the correct value or not + +EXPECT "1.0GB" get_hardlimit $V0 + +} + +_init; +check_fattrs; +cleanup + + + + diff --git a/tests/bugs/quota/bug-1049323.t b/tests/bugs/quota/bug-1049323.t new file mode 100755 index 00000000000..818c5f0e65b --- /dev/null +++ b/tests/bugs/quota/bug-1049323.t @@ -0,0 +1,64 @@ +#!/bin/bash +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +function _init() +{ +# Start glusterd +TEST glusterd; +TEST pidof glusterd; +TEST $CLI volume info; + +#Create a volume +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{1,2}; + +#Verify volume is created +EXPECT "$V0" volinfo_field $V0 'Volume Name'; +EXPECT 'Created' volinfo_field $V0 'Status'; + +#Start volume and verify +TEST $CLI volume start $V0; +EXPECT 'Started' volinfo_field $V0 'Status'; +TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 $M0 + +#Enable Quota +TEST $CLI volume quota $V0 enable + +##Wait for the auxiliary mount to comeup +sleep 3; +} + +function get_aux() +{ +##Check if a auxiliary mount is there +df -h | grep "/var/run/gluster/$V0" - + +if [ $? -eq 0 ] +then + echo "0" +else + echo "1" +fi +} + +function create_data() +{ +#set some limit on the volume +TEST $CLI volume quota $V0 limit-usage / 50MB; + +#Auxiliary mount should be there before stopping the volume +EXPECT "0" get_aux; + +TEST $CLI volume stop $V0; + +#Aux mount should have been removed +EXPECT "1" get_aux; + +} + + +_init; +create_data; +cleanup; diff --git a/tests/bugs/quota/bug-1087198.t b/tests/bugs/quota/bug-1087198.t new file mode 100644 index 00000000000..69ae18c7fe2 --- /dev/null +++ b/tests/bugs/quota/bug-1087198.t @@ -0,0 +1,77 @@ +#!/bin/bash + +## The script tests the logging of the quota in the bricks after reaching soft +## limit of the configured limit. +## +## Steps: +## 1. Create and mount the volume +## 2. Enable quota and set the limit on 2 directories +## 3. Write some data to cross the limit +## 4. Grep the string expected in brick logs +## 5. Wait for 10 seconds (alert timeout is set to 10s) +## 6. Repeat 3 and 4. +## 7. Cleanup + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../fileio.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../nfs.rc + +cleanup; + +#1 +## Step 1 +TEST glusterd +TEST pidof glusterd +TEST $CLI volume info; + +TEST $CLI volume create $V0 $H0:$B0/brick{1..4}; +EXPECT 'Created' volinfo_field $V0 'Status'; + +TEST $CLI volume start $V0; +EXPECT 'Started' volinfo_field $V0 'Status'; + +EXPECT_WITHIN $NFS_EXPORT_TIMEOUT "1" is_nfs_export_available; +TEST mount_nfs $H0:/$V0 $N0 noac,nolock + + +QUOTA_LIMIT_DIR="quota_limit_dir" +BRICK_LOG_DIR="`gluster --print-logdir`/bricks" + +#9 +TEST mkdir $N0/$QUOTA_LIMIT_DIR + +#10 +## Step 2 +TEST $CLI volume quota $V0 enable +TEST $CLI volume quota $V0 alert-time 10 +TEST $CLI volume quota $V0 hard-timeout 0 +TEST $CLI volume quota $V0 soft-timeout 0 +TEST $CLI volume quota $V0 limit-usage / 200KB +TEST $CLI volume quota $V0 limit-usage /$QUOTA_LIMIT_DIR 100KB + +#16 +## Step 3 and 4 +TEST dd if=/dev/urandom of=$N0/$QUOTA_LIMIT_DIR/95KB_file bs=1k count=95 +TEST grep -e "\"Usage crossed soft limit:.*used by /$QUOTA_LIMIT_DIR\"" -- $BRICK_LOG_DIR/* + +TEST dd if=/dev/urandom of=$N0/100KB_file bs=1k count=100 +TEST grep -e "\"Usage crossed soft limit:.*used by /\"" -- $BRICK_LOG_DIR/* + +#20 +## Step 5 +TEST sleep 10 + +## Step 6 +TEST dd if=/dev/urandom of=$N0/$QUOTA_LIMIT_DIR/1KB_file bs=1k count=1 +TEST grep -e "\"Usage is above soft limit:.*used by /$QUOTA_LIMIT_DIR\"" -- $BRICK_LOG_DIR/* + +#23 +TEST dd if=/dev/urandom of=$N0/1KB_file bs=1k count=1 +TEST grep -e "\"Usage is above soft limit:.*used by /\"" -- $BRICK_LOG_DIR/* + +#25 +## Step 7 +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $N0 + +cleanup; diff --git a/tests/bugs/quota/bug-1100050.t b/tests/bugs/quota/bug-1100050.t new file mode 100644 index 00000000000..e12f64f88d8 --- /dev/null +++ b/tests/bugs/quota/bug-1100050.t @@ -0,0 +1,25 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +TEST glusterd; +TEST pidof glusterd; + +TEST gluster volume create $V0 stripe 2 $H0:$B0/{1,2} force; +TEST gluster volume start $V0; +TEST glusterfs --volfile-server=$H0 --volfile-id=$V0 $M0; + +TEST gluster volume quota $V0 enable; + +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Y" quotad_up_status; + +TEST mkdir $M0/dir; + +TEST gluster volume quota $V0 limit-usage /dir 10MB; + +TEST mkdir $M0/dir/subdir; + +cleanup; diff --git a/tests/bugs/quota/bug-1104692.t b/tests/bugs/quota/bug-1104692.t new file mode 100755 index 00000000000..6f6b174aa03 --- /dev/null +++ b/tests/bugs/quota/bug-1104692.t @@ -0,0 +1,32 @@ +#!/bin/bash +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd + +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}0 $H0:$B0/${V0}1 $H0:$B0/${V0}2 $H0:$B0/${V0}3 +TEST $CLI volume start $V0 + +TEST glusterfs -s $H0 --volfile-id $V0 $M0; +TEST mkdir -p $M0/limit_one/limit_two/limit_three $M0/limit_four \ + $M0/limit_one/limit_five + +TEST $CLI volume set $V0 server.root-squash on +TEST $CLI volume quota $V0 enable + +TEST $CLI volume quota $V0 limit-usage / 1GB +TEST $CLI volume quota $V0 limit-usage /limit_one 1GB +TEST $CLI volume quota $V0 limit-usage /limit_one/limit_two 1GB +TEST $CLI volume quota $V0 limit-usage /limit_one/limit_two/limit_three 1GB +TEST $CLI volume quota $V0 limit-usage /limit_four 1GB +TEST $CLI volume quota $V0 limit-usage /limit_one/limit_five 1GB + +#Cleanup +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 +TEST $CLI volume stop $V0 +TEST $CLI volume delete $V0 + +cleanup; |