glusterfs

Форк
0
/
subdir-mount.t 
121 строка · 3.3 Кб
1
#!/bin/bash
2

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

6
cleanup;
7

8
## Start and create a volume
9
TEST glusterd
10
TEST pidof glusterd
11
TEST $CLI volume info;
12

13
TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{1,2,3,4};
14

15
## Start volume and verify
16
TEST $CLI volume start $V0;
17

18
## Mount FUSE with caching disabled (read-write)
19
TEST $GFS -s $H0 --volfile-id $V0 --volume-name ${V0}-dht $M0;
20

21
TEST ! stat $M0/subdir1;
22
TEST mkdir $M0/subdir1;
23
TEST ! stat $M0/subdir2;
24
TEST mkdir $M0/subdir2;
25
TEST ! stat $M0/subdir1/subdir1.1;
26
TEST mkdir $M0/subdir1/subdir1.1;
27
TEST ! stat $M0/subdir1/subdir1.1/subdir1.2;
28
TEST mkdir $M0/subdir1/subdir1.1/subdir1.2;
29

30
# mount volume/subdir1
31
TEST $GFS --subdir-mount /subdir1 -s $H0 --volfile-id $V0 --volume-name ${V0}-dht $M1;
32

33
TEST touch $M0/topfile;
34
TEST ! stat $M1/topfile;
35

36
TEST touch $M1/subdir1_file;
37
TEST ! stat $M0/subdir1_file;
38
TEST stat $M0/subdir1/subdir1_file;
39

40
# mount volume/subdir2
41
TEST $GFS --subdir-mount /subdir2 -s $H0 --volfile-id $V0 $M2;
42

43
TEST ! stat $M2/topfile;
44

45
TEST touch $M2/subdir2_file;
46
TEST ! stat $M0/subdir2_file;
47
TEST ! stat $M1/subdir2_file;
48
TEST stat $M0/subdir2/subdir2_file;
49

50
# umount $M1 / $M2
51
TEST umount $M1
52
TEST umount $M2
53

54
# mount non-existing subdir ; this works with mount.glusterfs,
55
# but with glusterfs, the script doesn't returns error.
56
#TEST ! $GFS --subdir-mount subdir_not_there -s $H0 --volfile-id $V0 $M1;
57

58
# mount subdir with depth
59
TEST $GFS --subdir-mount /subdir1/subdir1.1/subdir1.2 -s $H0 --volfile-id $V0 $M2;
60
TEST ! stat $M2/topfile;
61
TEST touch $M2/subdir1.2_file;
62
TEST ! stat $M0/subdir1.2_file;
63
TEST stat $M0/subdir1/subdir1.1/subdir1.2/subdir1.2_file;
64

65
TEST umount $M2
66

67
# Lets validate the options # Not having '*' in here as there was some
68
# problem with option validation with this
69
TEST $CLI volume set $V0 auth.allow 192.168.1.1
70

71
TEST $CLI volume set $V0 auth.allow "192.168.1.1,10.10.\*.\*,::1"
72

73
TEST $CLI volume set $V0 auth.allow "/subdir1\(1.2.3.4\),/\(192.168.10.2\|192.168.11.1\),/subdir2\(1.2.3.4\)"
74

75
# directories should be absolute
76
TEST ! $CLI volume set $V0 auth.allow "subdir2\(1.2.3.4\)"
77

78
# support subdir inside subdir
79
TEST $CLI volume set $V0 auth.allow '/subdir1/subdir1.1/subdir1.2/\(1.2.3.4\|::1\),/\(192.168.10.1\|192.168.11.1\),/subdir2\(1.2.3.4\)'
80

81
TEST $CLI volume stop $V0
82

83
TEST $CLI volume start $V0
84

85
TEST $GFS --subdir-mount /subdir1/subdir1.1/subdir1.2 -s $H0 --volfile-id $V0 $M2
86
TEST stat $M2
87

88
initcnt=`grep -i create-subdir-mounts /var/log/glusterfs/glusterd.log  | wc -l`
89
# mount shouldn't fail even after add-brick
90
TEST $CLI volume add-brick $V0 replica 2 $H0:$B0/${V0}{5,6};
91

92
# Wait to execute create-subdir-mounts.sh script by glusterd
93
newcnt=`grep -i create-subdir-mounts /var/log/glusterfs/glusterd.log  | wc -l`
94
while [ $newcnt -eq $initcnt ]
95
do
96
   newcnt=`grep -i create-subdir-mounts /var/log/glusterfs/glusterd.log  | wc -l`
97
   sleep 1
98
done
99

100
# Existing mount should still be active
101
mount_inode=$(stat --format "%i" "$M2")
102
TEST test "$mount_inode" == "1"
103

104
TEST umount $M2
105

106
# Now the exported subdirs should be automatically healed due to
107
# hook scripts. Check if the mount is successful.
108
TEST $GFS --subdir-mount /subdir2 -s $H0 --volfile-id $V0 $M2
109
mount_inode=$(stat --format "%i" "$M2")
110
TEST test "$mount_inode" == "1"
111

112
TEST umount $M0
113
TEST umount $M2
114

115

116
TEST $CLI volume stop $V0;
117
TEST $CLI volume delete $V0;
118
TEST ! $CLI volume info $V0;
119

120
## This should clean the mountpoints
121
cleanup;
122

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

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

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

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