summaryrefslogtreecommitdiffstats
path: root/tests/bugs/glusterd/df-results-post-replace-brick-operations.t
blob: 04f7588938818fd80e2f13114662a49f71e33121 (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
#!/bin/bash

. $(dirname $0)/../../include.rc
. $(dirname $0)/../../volume.rc

cleanup
TEST glusterd

#Create brick partitions
TEST truncate -s 100M $B0/brick1
TEST truncate -s 100M $B0/brick2
TEST truncate -s 100M $B0/brick3
TEST truncate -s 100M $B0/brick4
TEST truncate -s 100M $B0/brick5

LO1=`SETUP_LOOP $B0/brick1`
TEST [ $? -eq 0 ]
TEST MKFS_LOOP $LO1

LO2=`SETUP_LOOP $B0/brick2`
TEST [ $? -eq 0 ]
TEST MKFS_LOOP $LO2

LO3=`SETUP_LOOP $B0/brick3`
TEST [ $? -eq 0 ]
TEST MKFS_LOOP $LO3

LO4=`SETUP_LOOP $B0/brick4`
TEST [ $? -eq 0 ]
TEST MKFS_LOOP $LO4

LO5=`SETUP_LOOP $B0/brick5`
TEST [ $? -eq 0 ]
TEST MKFS_LOOP $LO5

TEST mkdir -p $B0/${V0}1 $B0/${V0}2 $B0/${V0}3 $B0/${V0}4 $B0/${V0}5
TEST MOUNT_LOOP $LO1 $B0/${V0}1
TEST MOUNT_LOOP $LO2 $B0/${V0}2
TEST MOUNT_LOOP $LO3 $B0/${V0}3
TEST MOUNT_LOOP $LO4 $B0/${V0}4
TEST MOUNT_LOOP $LO5 $B0/${V0}5

# create a subdirectory in mount point and use it for volume creation
TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}1/brick1 $H0:$B0/${V0}2/brick1 $H0:$B0/${V0}3/brick1
TEST $CLI volume start $V0
EXPECT_WITHIN $PROCESS_UP_TIMEOUT "3" online_brick_count

# mount the volume and check the size at mount point
TEST $GFS --volfile-server=$H0 --volfile-id=$V0 $M0
total_space=$(df -P $M0 | tail -1 | awk '{ print $2}')

# perform replace brick operations
TEST $CLI volume replace-brick $V0 $H0:$B0/${V0}1/brick1 $H0:$B0/${V0}4/brick1 commit force
TEST $CLI volume replace-brick $V0 $H0:$B0/${V0}2/brick1 $H0:$B0/${V0}5/brick1 commit force

EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 0
EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 1

# check for the size at mount point, it should be same as previous
total_space_new=$(df -P $M0 | tail -1 | awk '{ print $2}')
TEST [ $total_space -eq $total_space_new ]