blob: 9553f9247aa14809d2f4a73aee36abf00b8c4001 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
#!/bin/bash
. $(dirname $0)/../include.rc
. $(dirname $0)/../volume.rc
. $(dirname $0)/../traps.rc
grep $B0/patchy1 /proc/mounts &> /dev/null && umount $B0/patchy1
grep $B0/patchy2 /proc/mounts &> /dev/null && umount $B0/patchy2
mkdir $B0/${V0}{1..2}
TEST glusterd
TEST truncate --size $((30*1048576)) $B0/${V0}-dev1
push_trapfunc "rm -f $B0/${V0}-dev1"
TEST truncate --size $((30*1048576)) $B0/${V0}-dev2
push_trapfunc "rm -f $B0/${V0}-dev2"
TEST mkfs.xfs $B0/${V0}-dev1
TEST mkfs.xfs $B0/${V0}-dev2
TEST mount -o loop $B0/${V0}-dev1 $B0/${V0}1
TEST mount -o loop $B0/${V0}-dev2 $B0/${V0}2
TEST $CLI volume create $V0 $H0:$B0/${V0}1 $H0:$B0/${V0}2
TEST $CLI volume set $V0 cluster.min-free-disk 2MB
TEST $CLI volume set $V0 cluster.min-free-strict-mode on
TEST $CLI volume set $V0 cluster.du-refresh-interval-sec 0
TEST $CLI volume start $V0
TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 $M0
####################################
# Test re-directs of file creation #
####################################
# This should work, no redirects
TEST dd if=/dev/zero of=$M0/testfile1 bs=1M count=8
TEST [ -f /d/backends/${V0}2/testfile1 ] && [ ! -k /d/backends/${V0}1/testfile1 ]
TEST $CLI volume set $V0 cluster.min-free-disk 19MB
# This should work, & the file redirected
# Subvolume 2 should have the linkto &
# Subvolume 1 should have the original
TEST dd if=/dev/zero of=$M0/testfile3 bs=1M count=4
TEST [ -f /d/backends/${V0}1/testfile3 ] && [ ! -k /d/backends/${V0}1/testfile3 ]
TEST [ -k /d/backends/${V0}2/testfile3 ]
# This should fail, cluster is full
TEST ! dd if=/dev/zero of=$M0/testfile2 bs=1M count=23
###################
# Strict mode off #
###################
TEST $CLI volume set $V0 cluster.min-free-strict-mode off
TEST dd if=/dev/zero of=$M0/testfile1 bs=1M count=20
TEST rm -f $M0/testfile1
###################
# Strict mode on #
###################
TEST $CLI volume set $V0 cluster.min-free-strict-mode on
TEST ! dd if=/dev/zero of=$M0/testfile1 bs=1M count=16
TEST rm -f $M0/testfile1
# Cleanup will deal with our mounts for us, and (because we used "-o loop") our
# device files too, but not the underlying files. That will happen in the EXIT
# trap handler instead.
cleanup;
|