summaryrefslogtreecommitdiffstats
path: root/dvm/765307/testcase
blob: b00c04fbaf3c1b4b05a055ec12511cb1606214ff (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
77
78
79
80
81
82
#!/bin/bash

source $cwd/regression_helpers

$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

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

mount_glusterfs $global_bug_id

cd $FUSE_MOUNT

# Creating directory tree with depth 100

for i in {1..100}
do
    mkdir $i
    cd $i
    touch $i
done

# come back to topmost directory
cd $FUSE_MOUNT

# replace a brick with force
$GLUSTERFSDIR/gluster volume replace-brick $global_bug_id $(hostname):$EXPORT_DIR/$global_bug_id/brick2 \
                             $(hostname):$EXPORT_DIR/$global_bug_id/brick3 start 1>/dev/null 2>/dev/null

time_out=0
status=0

while [[ $status -ne 1 && $time_out -le 300 ]]
do
    status=$($GLUSTERFSDIR/gluster volume replace-brick $global_bug_id\
                            $(hostname):$EXPORT_DIR/$global_bug_id/brick2\
                            $(hostname):$EXPORT_DIR/$global_bug_id/brick3 status | grep 'Migration complete'|wc -l)

    time_out=$(( $time_out + 1))
    sleep 1
done

if [ $time_out -gt 300 ]; then
    exit 1
fi

$GLUSTERFSDIR/gluster volume replace-brick $global_bug_id\
        $(hostname):$EXPORT_DIR/$global_bug_id/brick2\
        $(hostname):$EXPORT_DIR/$global_bug_id/brick3 commit\
        |grep 'replace-brick commit successful' 1>/dev/null 2>/dev/null

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

# unmount and mount
# to see the files immediately on the mount point
# otherwise some of the files shown as not present
# on the replaced brick

cd /
umount -f $FUSE_MOUNT
sleep 5
mount_glusterfs $global_bug_id
sleep 5
cd $FUSE_MOUNT

# now check the directories in all levels are preserved
for i in {1..100}
do
    if [ ! -d "$i" ]; then
        exit 1
    else
        cd $i
        if [ ! -f "$i" ]; then
            exit 1
        fi
    fi
done

exit 0