glusterfs

Форк
0
/
bug-1099890.t 
130 строк · 3.5 Кб
1
#!/bin/bash
2

3
. $(dirname $0)/../../include.rc
4
. $(dirname $0)/../../volume.rc
5
. $(dirname $0)/../../dht.rc
6

7
## TO-DO: Fix the following once the dht du refresh interval issue is fixed:
8
## 1. Do away with sleep(1).
9
## 2. Do away with creation of empty files.
10

11
cleanup;
12

13
QDD=$(dirname $0)/quota
14
# compile the test write program and run it
15
build_tester $(dirname $0)/../../basic/quota.c -o $QDD
16

17
TEST   glusterd;
18
TEST   pidof glusterd;
19

20
# Create 2 loop devices, one per brick.
21
TEST   truncate -s 100M $B0/brick1
22
TEST   truncate -s 100M $B0/brick2
23

24
TEST   L1=`SETUP_LOOP $B0/brick1`
25
TEST   MKFS_LOOP $L1
26

27
TEST   L2=`SETUP_LOOP $B0/brick2`
28
TEST   MKFS_LOOP $L2
29

30
TEST   mkdir -p $B0/${V0}{1,2}
31

32
TEST   MOUNT_LOOP $L1 $B0/${V0}1
33
TEST   MOUNT_LOOP $L2 $B0/${V0}2
34

35
# Create a plain distribute volume with 2 subvols.
36
TEST   $CLI volume create $V0 $H0:$B0/${V0}{1,2};
37

38
TEST   $CLI volume start $V0;
39
EXPECT "Started" volinfo_field $V0 'Status';
40

41
TEST   $CLI volume quota $V0 enable;
42

43
TEST   $CLI volume set $V0 features.quota-deem-statfs on
44

45
TEST   $CLI volume quota $V0 limit-usage / 150MB;
46

47
TEST   $CLI volume set $V0 cluster.min-free-disk 50%
48

49
TEST   glusterfs -s $H0 --volfile-id=$V0 $M0
50

51
# Make sure quota-deem-statfs is working as expected
52
EXPECT "150M" echo `df -h $M0 -P | tail -1 | awk {'print $2'}`
53

54
# Create a new file 'foo' under the root of the volume, which hashes to subvol-0
55
# of DHT, that consumes 40M
56
TEST $QDD $M0/foo 256 160
57

58
TEST   stat $B0/${V0}1/foo
59
TEST ! stat $B0/${V0}2/foo
60

61
# Create a new file 'bar' under the root of the volume, which hashes to subvol-1
62
# of DHT, that consumes 40M
63
TEST $QDD $M0/bar 256 160
64

65
TEST ! stat $B0/${V0}1/bar
66
TEST   stat $B0/${V0}2/bar
67

68
# Touch a zero-byte file on the root of the volume to make sure the statfs data
69
# on DHT is refreshed
70
sleep 1;
71
TEST   touch $M0/empty1;
72

73
# At this point, the available space on each subvol {60M,60M} is greater than
74
# their min-free-disk {50M,50M}, but if this bug still exists, then
75
# the total available space on the volume as perceived by DHT should be less
76
# than min-free-disk, i.e.,
77
#
78
# consumed space returned per subvol by quota = (40M + 40M) = 80M
79
#
80
# Therefore, consumed space per subvol computed by DHT WITHOUT the fix would be:
81
# (80M/150M)*100 = 53%
82
#
83
# Available space per subvol as perceived by DHT with the bug = 47%
84
# which is less than min-free-disk
85

86
# Now I create a file that hashes to subvol-1 (counting from 0) of DHT.
87
# If this bug still exists,then DHT should be routing this creation to subvol-0.
88
# If this bug is fixed, then DHT should be routing the creation to subvol-1 only
89
# as it has more than min-free-disk space available.
90

91
TEST $QDD $M0/file 1 1
92
sleep 1;
93
TEST ! stat $B0/${V0}1/file
94
TEST   stat $B0/${V0}2/file
95

96
# Touch another zero-byte file on the root of the volume to refresh statfs
97
# values stored by DHT.
98

99
TEST touch $M0/empty2;
100

101
# Now I create a new file that hashes to subvol-0, at the end of which, there
102
# will be less than min-free-disk space available on it.
103
TEST $QDD $M0/fil 256 80
104
sleep 1;
105
TEST   stat $B0/${V0}1/fil
106
TEST ! stat $B0/${V0}2/fil
107

108
# Touch to refresh statfs info cached by DHT
109

110
TEST   touch $M0/empty3;
111

112
# Now I create a file that hashes to subvol-0 but since it has less than
113
# min-free-disk space available, its data will be cached on subvol-1.
114

115
TEST $QDD $M0/zz 256 20
116

117
TEST   stat $B0/${V0}1/zz
118
TEST   stat $B0/${V0}2/zz
119

120
EXPECT "$V0-client-1" dht_get_linkto_target "$B0/${V0}1/zz"
121

122
EXPECT "1" is_dht_linkfile "$B0/${V0}1/zz"
123

124
force_umount $M0
125
TEST $CLI volume stop $V0
126
UMOUNT_LOOP ${B0}/${V0}{1,2}
127
rm -f ${B0}/brick{1,2}
128

129
rm -f $QDD
130
cleanup
131

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

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

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

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