diff options
author | Ravishankar N <ravishankar@redhat.com> | 2016-04-29 17:41:18 +0530 |
---|---|---|
committer | Atin Mukherjee <amukherj@redhat.com> | 2016-05-19 09:40:04 -0700 |
commit | 61c1b2cee973b11897a37d508910012e616033bc (patch) | |
tree | fbaf9adc16738884c9c073677ac01704f8f6f560 /tests | |
parent | 6f1a71210ee0a0f3741b5ece3b5240c1e4b5fa6d (diff) |
cli/glusterd: add/remove brick fixes for arbiter volumes
1.Provide a command to convert replica 2 volumes to arbiter volumes.
Existing self-heal logic will automatically heal the file hierarchy into
the arbiter brick, the progress of which can be monitored using the
heal info command.
Syntax: gluster volume add-brick <VOLNAME> replica 3 arbiter 1
<HOST:arbiter-brick-path>
2. Add checks when removing bricks from arbiter volumes:
- When converting from arbiter to replica 2 volume, allow only arbiter
brick to be removed.
- When converting from arbiter to plain distribute volume, allow only if
arbiter is one of the bricks that is removed.
3. Some clean-up:
- Use GD_MSG_DICT_GET_SUCCESS instead of GD_MSG_DICT_GET_FAILED to
log messages that are not failures.
- Remove unused variable `brick_list`
- Move 'brickinfo->group' related functions to glusted-utils.
Change-Id: Ic87b8c7e4d7d3ab03f93e7b9f372b314d80947ce
BUG: 1318289
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Reviewed-on: http://review.gluster.org/14126
Smoke: Gluster Build System <jenkins@build.gluster.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/basic/afr/arbiter-add-brick.t | 60 | ||||
-rw-r--r-- | tests/basic/afr/arbiter-remove-brick.t | 36 |
2 files changed, 96 insertions, 0 deletions
diff --git a/tests/basic/afr/arbiter-add-brick.t b/tests/basic/afr/arbiter-add-brick.t new file mode 100644 index 00000000000..357f59b0852 --- /dev/null +++ b/tests/basic/afr/arbiter-add-brick.t @@ -0,0 +1,60 @@ +#!/bin/bash +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +cleanup; + +TEST glusterd +TEST pidof glusterd + +#Create replica 2 volume and create file/dir. +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1} +TEST $CLI volume set $V0 performance.stat-prefetch off +TEST $CLI volume start $V0 +TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 $M0; +TEST mkdir $M0/dir1 +TEST dd if=/dev/urandom of=$M0/file1 bs=1024 count=1 + +#Kill second brick and perform I/O to have pending heals. +TEST kill_brick $V0 $H0 $B0/${V0}1 +TEST mkdir $M0/dir2 +TEST dd if=/dev/urandom of=$M0/file1 bs=1024 count=1024 + + +#syntax check for add-brick. +TEST ! $CLI volume add-brick $V0 replica 2 arbiter 1 $H0:$B0/${V0}2 +TEST ! $CLI volume add-brick $V0 replica 3 arbiter 2 $H0:$B0/${V0}2 + +#convert replica 2 to arbiter volume +TEST $CLI volume add-brick $V0 replica 3 arbiter 1 $H0:$B0/${V0}2 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}2 + +#Heal files +TEST $CLI volume start $V0 force +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}1 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Y" glustershd_up_status +EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 0 +EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 1 +EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 2 +EXPECT_WITHIN $HEAL_TIMEOUT "0" get_pending_heal_count $V0 + +#Perform I/O after add-brick +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" afr_child_up_status $V0 0 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" afr_child_up_status $V0 1 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" afr_child_up_status $V0 2 +TEST mkdir $M0/dir3 +TEST dd if=/dev/urandom of=$M0/file2 bs=1024 count=1024 + +# File hierarchy must be same in all 3 bricks. +TEST diff <(ls $B0/${V0}0 | sort) <(ls $B0/${V0}2 | sort) +TEST diff <(ls $B0/${V0}1 | sort) <(ls $B0/${V0}2 | sort) + +#Mount serves the correct file size +EXPECT "1048576" stat -c %s $M0/file1 +EXPECT "1048576" stat -c %s $M0/file2 + +#Check file size in arbiter brick +EXPECT "0" stat -c %s $B0/${V0}2/file1 +EXPECT "0" stat -c %s $B0/${V0}2/file2 + +TEST force_umount $M0 +cleanup; diff --git a/tests/basic/afr/arbiter-remove-brick.t b/tests/basic/afr/arbiter-remove-brick.t new file mode 100644 index 00000000000..5a6daa95cfd --- /dev/null +++ b/tests/basic/afr/arbiter-remove-brick.t @@ -0,0 +1,36 @@ +#!/bin/bash +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +cleanup; + +TEST glusterd +TEST pidof glusterd + +#Create arbiter volume. +TEST $CLI volume create $V0 replica 3 arbiter 1 $H0:$B0/${V0}{0,1,2} +EXPECT "1 x \(2 \+ 1\) = 3" volinfo_field $V0 "Number of Bricks" +TEST $CLI volume set $V0 performance.stat-prefetch off +TEST $CLI volume start $V0 +TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 $M0; + +#syntax check for remove-brick. +TEST ! $CLI volume remove-brick $V0 replica 2 $H0:$B0/${V0}0 force +TEST ! $CLI volume remove-brick $V0 replica 2 $H0:$B0/${V0}1 force + +#convert to replica 2 volume +TEST $CLI volume remove-brick $V0 replica 2 $H0:$B0/${V0}2 force +EXPECT "1 x 2 = 2" volinfo_field $V0 "Number of Bricks" + +TEST mkdir $M0/dir +TEST dd if=/dev/urandom of=$M0/file bs=1024 count=1024 +TEST diff <(ls $B0/${V0}0 | sort) <(ls $B0/${V0}1 | sort) + +#Mount serves the correct file size +EXPECT "1048576" stat -c %s $M0/file + +#Check file size in bricks +EXPECT "1048576" stat -c %s $B0/${V0}0/file +EXPECT "1048576" stat -c %s $B0/${V0}1/file + +TEST force_umount $M0 +cleanup; |