summaryrefslogtreecommitdiffstats
path: root/dvm/765453/testcase
blob: 3a9792cc828a2a42bfdede338fa57f60ae0671e6 (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
70
71
72
73
74
75
76
#!/bin/bash

source $cwd/regression_helpers



ATTR=trusted.glusterfs.testattr
VAL="thisistestattrib"
START="start"
STATUS="status"

$GLUSTERFSDIR/gluster volume create $global_bug_id $(hostname):$EXPORT_DIR/$global_bug_id/brick1\
                                $(hostname):$EXPORT_DIR/$global_bug_id/brick2 2>/dev/null 1>/dev/null

ret=$?

if [ $ret -ne 0 ]; then
    exit 1
fi


$GLUSTERFSDIR/gluster volume start $global_bug_id 2>/dev/null 1>/dev/null;
sleep 5;

ret=$?
if [ $ret -ne 0 ]; then
    exit 1
fi



mount_glusterfs $global_bug_id;

for i in {1..10}
do
    touch $FUSE_MOUNT/$i
    setfattr -n $ATTR -v $VAL $FUSE_MOUNT/$i 2>/dev/null 1>/dev/null
done

#add a new brick to the volume
$GLUSTERFSDIR/gluster volume add-brick $global_bug_id $(hostname):$EXPORT_DIR/$global_bug_id/brick3\
                                $(hostname):$EXPORT_DIR/$global_bug_id/brick4 2>/dev/null 1>/dev/null

#Initiate rebalance

$GLUSTERFSDIR/gluster volume rebalance $global_bug_id  $START 2>/dev/null 1>/dev/null

status=0

time_out=0
while [[ $status -ne 1 && $time_out -le 300 ]]
do
    status=$($GLUSTERFSDIR/gluster volume rebalance $global_bug_id status| grep 'rebalance completed'|wc -l);
    time_out=$(( $time_out + 1))
    sleep 1;
done

# for some reason rebalance is hung so we errout
# assuming 300 is fairly enough for rebalancing
# 10 files
if [ $time_out -gt 300 ]; then
    exit 1
fi

#check whether xattrs are preserved after rebalance

for i in {1..10}
do
    getfattr -d -e text -n $ATTR -m . $FUSE_MOUNT/$i 2>/dev/null | grep "$VAL" 2>/dev/null 1>/dev/null
    ret=$?
    if [ $ret -ne 0 ]; then
        exit 1
    fi
done

exit 0