1
0
mirror of https://github.com/gluster/glusterfs.git synced 2026-02-06 09:48:44 +01:00
Files
glusterfs/tests/basic/inode-namespace.t
Amar Tumballi 1bc2c76eba Simple quota: based on namespace (#1750)
* the quota setting can happen only on 'namespace' inode.
* once set, the accounting is maintained only at the namespace level for whole tree.
* uses 'simple-quota' key to show the correct quota usage in distributed volume.
* statfs()'s response would be used to set the the volume level usage in xlator,
  in setxattr() call, when done through a special mount process.
* the xlator is designed to be on brick graph, and saves only the usage of data
  inside it.
* An option is provided to utilize the backend filesystem's quota feature for
  'accounting', which can improve the performance.
  - This PR expects backend quota to properly return `statfs()` (or `df`) output.
    If `features.simple-quota.use-backend` option is set, then there wont be any
    active accounting in simple-quota translator, but only `setxattr()` and
    `statfs()` is handled for special keys. We expect helper function to
    set 'quota-limit' and also 'namespace' xattr to aid the glusterfs process in
    general to identify the entries.

Updates: #1774
Change-Id: Id4229b720b57cde458b9b36e36ada3ffe2be0ac2
Signed-off-by: Amar Tumballi <amar@kadalu.io>
2022-03-31 11:17:41 +05:30

71 lines
1.6 KiB
Bash
Executable File

#!/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 $H0:$B0/${V0}
TEST $CLI volume start $V0;
## Mount FUSE
TEST $GFS -s $H0 --volfile-id $V0 $M1;
TEST mkdir $M1/test1;
TEST mkdir $M1/test2;
# User from regular mount can't set namespace, but only the special pid (ie, <0)
TEST ! setfattr -n trusted.glusterfs.namespace -v true $M1/test2;
## Mount FUSE
TEST $GFS -s $H0 --volfile-id $V0 --client-pid=-10 --process-name=namespace-test $M2;
#TEST $GFS -s $H0 --volfile-id $V0 --process-name=namespace-test $M2;
TEST df -h $M1
sleep 1;
TEST setfattr -n trusted.glusterfs.namespace -v true $M2/test1;
TEST setfattr -n trusted.glusterfs.namespace -v true $M2/test2;
TEST touch $M1/test2/file{1,2,11,12};
TEST touch $M1/test1/file{1,2,11,12};
# This technically fails if we can only check rename(2).
mv $M1/test1/file1 $M1/test2/file3 ;
TEST grep 'cross-device' $(glusterfsd --print-logdir)/bricks/*
TEST mv $M1/test2/file2 $M1/test2/file4 ;
TEST ! ln $M1/test1/file11 $M1/test2/file5 ;
TEST ln $M1/test1/file2 $M1/test1/file6 ;
TEST kill_brick $V0 $H0 $B0/${V0};
TEST $CLI volume start $V0 force;
sleep 3;
TEST ! ln $M2/test1/file12 $M2/test2/file7 ;
TEST ln $M2/test1/file2 $M2/test1/file8 ;
TEST $CLI volume stop $V0;
TEST $CLI volume start $V0;
sleep 3;
mv $M1/test2/file11 $M1/test1/file9 ;
echo "$(grep 'cross-device' $(glusterfsd --print-logdir)/bricks/* | grep server_rename_resume)"
TEST mv $M1/test2/file12 $M1/test2/file10 ;
TEST ! setfattr -x trusted.glusterfs.namespace $M2/test1;
cleanup;