glusterfs

Форк
0
/
bug-904065.t 
100 строк · 3.1 Кб
1
#!/bin/bash
2
#
3
# This test does not use 'showmount' from the nfs-utils package, it would
4
# require setting up a portmapper (either rpcbind or portmap, depending on the
5
# Linux distribution used for testing). The persistancy of the rmtab should not
6
# affect the current showmount outputs, so existing regression tests should be
7
# sufficient.
8
#
9

10
#G_TESTDEF_TEST_STATUS_CENTOS6=NFS_TEST
11

12
# count the lines of a file, return 0 if the file does not exist
13
function count_lines()
14
{
15
        if [ -e "$1" ]
16
        then
17
                wc -l < $1
18
        else
19
                echo 0
20
        fi
21
}
22

23

24
. $(dirname $0)/../../include.rc
25
. $(dirname $0)/../../nfs.rc
26
. $(dirname $0)/../../volume.rc
27

28
cleanup
29

30
TEST glusterd
31
TEST pidof glusterd
32

33
TEST $CLI volume create $V0 $H0:$B0/brick1
34
EXPECT 'Created' volinfo_field $V0 'Status'
35
TEST $CLI volume set $V0 nfs.disable false
36

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

40
# glusterfs/nfs needs some time to start up in the background
41
EXPECT_WITHIN $NFS_EXPORT_TIMEOUT 1 is_nfs_export_available
42

43
# before mounting the rmtab should be empty
44
EXPECT '0' count_lines $GLUSTERD_WORKDIR/nfs/rmtab
45

46
TEST mount_nfs $H0:/$V0 $N0 nolock
47
# the output would looks similar to:
48
#
49
#   hostname-0=172.31.122.104
50
#   mountpoint-0=/ufo
51
#
52
EXPECT '2' count_lines $GLUSTERD_WORKDIR/nfs/rmtab
53

54
# duplicate mounts should not be recorded (client could have crashed)
55
TEST mount_nfs $H0:/$V0 $N1 nolock
56
EXPECT '2' count_lines $GLUSTERD_WORKDIR/nfs/rmtab
57

58
# removing a mount should (even if there are two) should remove the entry
59
EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $N1
60
EXPECT '0' count_lines $GLUSTERD_WORKDIR/nfs/rmtab
61

62
# unmounting the other mount should work flawlessly
63
EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $N0
64
EXPECT '0' count_lines $GLUSTERD_WORKDIR/nfs/rmtab
65

66
TEST glusterfs --entry-timeout=0 --attribute-timeout=0 --volfile-server=$H0 --volfile-id=$V0 $M0
67

68
# we'll create a fake rmtab here, similar to how an other storage server would do
69
# using an invalid IP address to prevent (unlikely) collisions on the test-machine
70
cat << EOF > $M0/rmtab
71
hostname-0=127.0.0.256
72
mountpoint-0=/ufo
73
EOF
74
EXPECT '2' count_lines $M0/rmtab
75

76
# reconfigure merges the rmtab with the one on the volume
77
TEST gluster volume set $V0 nfs.mount-rmtab $M0/rmtab
78

79
# glusterfs/nfs needs some time to restart
80
EXPECT_WITHIN $NFS_EXPORT_TIMEOUT 1 is_nfs_export_available
81

82
# Apparently "is_nfs_export_available" might return even if the export is
83
# not, in fact, available.  (eyeroll)  Give it a bit of extra time.
84
#
85
# TBD: fix the broken shell function instead of working around it here
86
sleep 5
87

88
# a new mount should be added to the rmtab, not overwrite exiting ones
89
TEST mount_nfs $H0:/$V0 $N0 nolock
90
EXPECT_WITHIN $PROCESS_UP_TIMEOUT '4' count_lines $M0/rmtab
91

92
EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $N0
93
EXPECT '2' count_lines $M0/rmtab
94

95
# TODO: nfs/reconfigure() is never called and is therefor disabled. When the
96
# NFS-server supports reloading and does not get restarted anymore, we should
97
# add a test that includes the merging of entries in the old rmtab with the new
98
# rmtab.
99

100
cleanup
101

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

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

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

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