glusterfs/tests/dht.rc
ggarg dd5e318e02 glusterd: Differentiate rebalance status and remove-brick status messages
previously when user triggred 'gluster volume remove-brick VOLNAME
BRICK start' then command' gluster volume rebalance <volname> status'
showing output even user has not triggred "rebalance start" and when
user triggred 'gluster volume rebalance <volname> start' then command
'gluster volume remove-brick VOLNAME BRICK status' showing output even
user has not run rebalance start and remove brick start.

regression test failed in previous patch. file test/dht.rc and
test/bug/bug-973073 edited to avoid regression test failure.

now with this fix it will differentiate rebalance and remove-brick
status messages.

Signed-off-by: ggarg <ggarg@redhat.com>

Change-Id: I7f92ad247863b9f5fbc0887cc2ead07754bcfb4f
BUG: 1089668
Reviewed-on: http://review.gluster.org/7517
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-by: Humble Devassy Chirammal <humble.devassy@gmail.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2014-05-02 09:31:45 -07:00

94 lines
2.0 KiB
Bash

#!/bin/bash
function get_layout()
{
getfattr -n trusted.glusterfs.dht -e hex $1 2>&1|grep dht |cut -d = -f2
}
## populates $BRICK1 and $BRICK2 with hashed/cached subvolume. These will be
## used by get_cached_brick and get_hashed_brick
function file_has_linkfile()
{
k=0
l=0
while [ $k -lt $BRICK_COUNT ]
do
stat=`stat $B0/${V0}$k/$1 2>/dev/null`
if [ $? -eq 0 ]
then
let l++
let "BRICK${l}=$k"
fi
let k++
done
return $l
}
function get_cached_brick()
{
i=1
brick=$BRICK1
while [ $i -lt 3 ]
do
test=`getfattr -n trusted.glusterfs.dht.linkto -e text $B0/${V0}$brick/$1 2>&1`
if [ $? -eq 1 ]
then
cached=$brick
i=$(( $i+3 ))
fi
brick=$BRICK1
let i++
done
return $cached
}
function get_hashed_brick()
{
j=1
brick=$BRICK1
while [ $j -lt 3 ]
do
test=`getfattr -n trusted.glusterfs.dht.linkto -e text $B0/${V0}$brick/$1 2>&1`
if [ $? -eq 0 ]
then
hashed=$brick
j=$(( $j+3 ))
fi
brick=$BRICK2
let j++
done
return $hashed
}
function rebalance_completed()
{
val=1
test=`gluster volume rebalance $V0 status |grep localhost|grep -v "in progress" 2>&1`
if [ $? -eq 0 ]
then
val=0
fi
echo $val
return $val
}
function remove_brick_completed()
{
val=1
test=`gluster volume remove-brick $V0 $H0:$B0/${V0}2 status |grep localhost|grep -v "in progress" 2>&1`
if [ $? -eq 0 ]
then
val=0
fi
echo $val
return $val
}