glusterfs

Форк
0
99 строк · 2.5 Кб
1
#!/bin/bash
2

3
. $(dirname $0)/../../include.rc
4
. $(dirname $0)/../../nfs.rc
5

6
#G_TESTDEF_TEST_STATUS_CENTOS6=NFS_TEST
7

8
cleanup;
9

10
TEST glusterd
11
TEST pidof glusterd
12
TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{1,2};
13
TEST $CLI volume set $V0 performance.open-behind off;
14
TEST $CLI volume set $V0 nfs.disable false
15
TEST $CLI volume start $V0
16

17
## Mount FUSE with caching disabled
18
TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id $V0 $M0;
19

20
EXPECT_WITHIN $NFS_EXPORT_TIMEOUT "1" is_nfs_export_available;
21

22

23
useradd tmp_user 2>/dev/null 1>/dev/null;
24
mkdir $M0/dir;
25
mkdir $M0/other;
26
cp /etc/passwd $M0/;
27
cp $M0/passwd $M0/file;
28
chmod 600 $M0/file;
29

30
TEST mount_nfs $H0:/$V0 $N0 nolock;
31

32
grep nfsnobody /etc/passwd > /dev/null
33
if [ $? -eq 1 ]; then
34
usr=nobody
35
grp=nobody
36
else
37
usr=nfsnobody
38
grp=nfsnobody
39
fi
40
chown -R $usr:$grp $M0/dir;
41
chown -R tmp_user:tmp_user $M0/other;
42

43
TEST $CLI volume set $V0 server.root-squash on;
44

45
EXPECT_WITHIN $NFS_EXPORT_TIMEOUT "1" is_nfs_export_available;
46

47
# create files and directories in the root of the glusterfs and nfs mount
48
# which is owned by root and hence the right behavior is getting EACCESS
49
# as the fops are executed as nfsnobody/nobody.
50
touch $M0/foo 2>/dev/null;
51
TEST [ $? -ne 0 ]
52
touch $N0/foo 2>/dev/null;
53
TEST [ $? -ne 0 ]
54
mkdir $M0/new 2>/dev/null;
55
TEST [ $? -ne 0 ]
56
mkdir $N0/new 2>/dev/null;
57
TEST [ $? -ne 0 ]
58
cp $M0/file $M0/tmp_file 2>/dev/null;
59
TEST [ $? -ne 0 ]
60
cp $N0/file $N0/tmp_file 2>/dev/null;
61
TEST [ $? -ne 0 ]
62
cat $M0/file 2>/dev/null;
63
TEST [ $? -ne 0 ]
64
# here read should be allowed because eventhough file "passwd" is owned
65
# by root, the permissions if the file allow other users to read it.
66
cat $M0/passwd 1>/dev/null;
67
TEST [ $? -eq 0 ]
68
cat $N0/passwd 1>/dev/null;
69
TEST [ $? -eq 0 ]
70

71
# create files and directories should succeed as the fops are being executed
72
# inside the directory owned by nfsnobody/nobody
73
TEST touch $M0/dir/file;
74
TEST touch $N0/dir/foo;
75
TEST mkdir $M0/dir/new;
76
TEST mkdir $N0/dir/other;
77
TEST rm -f $M0/dir/file $M0/dir/foo;
78
TEST rmdir $N0/dir/*;
79

80
# create files and directories here should fail as other directory is owned
81
# by tmp_user.
82
touch $M0/other/foo 2>/dev/null;
83
TEST [ $? -ne 0 ]
84
touch $N0/other/foo 2>/dev/null;
85
TEST [ $? -ne 0 ]
86
mkdir $M0/other/new 2>/dev/null;
87
TEST [ $? -ne 0 ]
88
mkdir $N0/other/new 2>/dev/null;
89
TEST [ $? -ne 0 ]
90

91
userdel tmp_user;
92
rm -rf /home/tmp_user;
93

94
EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" umount_nfs $N0
95

96
TEST $CLI volume stop $V0;
97
TEST $CLI volume delete $V0;
98

99
cleanup;
100

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.