glusterfs
69 строк · 1.4 Кб
1#!/bin/bash
2
3SCRIPT_TIMEOUT=250
4
5. $(dirname $0)/../../include.rc
6. $(dirname $0)/../../volume.rc
7. $(dirname $0)/../../dht.rc
8
9
10# create 2 subvols
11# create a dir
12# create a file
13# change layout
14# remove the file
15# execute create from a different mount
16# Without the patch, the file will be present on both of the bricks
17
18cleanup
19
20function get_layout () {
21
22layout=`getfattr -n trusted.glusterfs.dht -e hex $1 2>&1 | grep dht | gawk -F"=" '{print $2}'`
23
24echo $layout
25
26}
27
28function set_layout()
29{
30setfattr -n "trusted.glusterfs.dht" -v $1 $2
31}
32
33TEST glusterd
34TEST pidof glusterd
35
36BRICK1=$B0/${V0}-0
37BRICK2=$B0/${V0}-1
38
39TEST $CLI volume create $V0 $H0:$BRICK1 $H0:$BRICK2
40TEST $CLI volume start $V0
41
42# Mount FUSE and create symlink
43TEST glusterfs -s $H0 --volfile-id $V0 $M0
44TEST mkdir $M0/dir
45TEST touch $M0/dir/file
46TEST ! stat "$BRICK1/dir/file"
47TEST stat "$BRICK2/dir/file"
48
49layout1="$(get_layout "$BRICK1/dir")"
50layout2="$(get_layout "$BRICK2/dir")"
51
52TEST set_layout $layout1 "$BRICK2/dir"
53TEST set_layout $layout2 "$BRICK1/dir"
54
55TEST rm $M0/dir/file -f
56TEST gluster v set $V0 client-log-level DEBUG
57
58#Without the patch in place, this client will create the file in $BRICK2
59#which will lead to two files being on both the bricks when a new client
60#create the file with the same name
61TEST touch $M0/dir/file
62
63TEST glusterfs -s $H0 --volfile-id $V0 $M1
64TEST touch $M1/dir/file
65
66TEST stat "$BRICK1/dir/file"
67TEST ! stat "$BRICK2/dir/file"
68
69cleanup
70