summaryrefslogtreecommitdiffstats
path: root/dvm/764302/testcase
blob: 0257549e6c528b14b5a694fefd3852e050f6e063 (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
#!/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 1>/dev/null 2>/dev/null


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

# kill first brick process
$GLUSTERFSDIR/gluster volume status $global_bug_id| tr "\t" " " |head -5| tail -1| awk '{print $4}'| xargs kill -9

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

# Check whether brick is in offline state
$GLUSTERFSDIR/gluster volume status $global_bug_id| tr "\t" " " |head -5| \
                    tail -1| awk '{print $3}'| grep N 1>/dev/null 2>/dev/null

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

# Now replace the dead brick
$GLUSTERFSDIR/gluster volume replace-brick $global_bug_id\
                 $(hostname):$EXPORT_DIR/$global_bug_id/brick1\
                 $(hostname):$EXPORT_DIR/$global_bug_id/brick3 start\
                 | grep "Source brick $(hostname):$EXPORT_DIR/$global_bug_id/brick1 is not online."\
                 1>/dev/null 2>/dev/null

ret=$?

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


exit 0