From 93b51950c5e0e1bbc5064a4f83779ec4ef19fde8 Mon Sep 17 00:00:00 2001 From: shylesh Date: Wed, 4 Jan 2012 12:31:27 +0530 Subject: Bug:765453: check whether xattrs preserved after rebalance Change-Id: I4a5111ef8b00cc28488c7633a321e6c9866295bc BUG: 765453 Signed-off-by: shylesh --- dvm/765453/testcase | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100755 dvm/765453/testcase diff --git a/dvm/765453/testcase b/dvm/765453/testcase new file mode 100755 index 0000000..3a9792c --- /dev/null +++ b/dvm/765453/testcase @@ -0,0 +1,76 @@ +#!/bin/bash + +source $cwd/regression_helpers + + + +ATTR=trusted.glusterfs.testattr +VAL="thisistestattrib" +START="start" +STATUS="status" + +$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 + +ret=$? + +if [ $ret -ne 0 ]; then + exit 1 +fi + + +$GLUSTERFSDIR/gluster volume start $global_bug_id 2>/dev/null 1>/dev/null; +sleep 5; + +ret=$? +if [ $ret -ne 0 ]; then + exit 1 +fi + + + +mount_glusterfs $global_bug_id; + +for i in {1..10} +do + touch $FUSE_MOUNT/$i + setfattr -n $ATTR -v $VAL $FUSE_MOUNT/$i 2>/dev/null 1>/dev/null +done + +#add a new brick to the volume +$GLUSTERFSDIR/gluster volume add-brick $global_bug_id $(hostname):$EXPORT_DIR/$global_bug_id/brick3\ + $(hostname):$EXPORT_DIR/$global_bug_id/brick4 2>/dev/null 1>/dev/null + +#Initiate rebalance + +$GLUSTERFSDIR/gluster volume rebalance $global_bug_id $START 2>/dev/null 1>/dev/null + +status=0 + +time_out=0 +while [[ $status -ne 1 && $time_out -le 300 ]] +do + status=$($GLUSTERFSDIR/gluster volume rebalance $global_bug_id status| grep 'rebalance completed'|wc -l); + time_out=$(( $time_out + 1)) + sleep 1; +done + +# for some reason rebalance is hung so we errout +# assuming 300 is fairly enough for rebalancing +# 10 files +if [ $time_out -gt 300 ]; then + exit 1 +fi + +#check whether xattrs are preserved after rebalance + +for i in {1..10} +do + getfattr -d -e text -n $ATTR -m . $FUSE_MOUNT/$i 2>/dev/null | grep "$VAL" 2>/dev/null 1>/dev/null + ret=$? + if [ $ret -ne 0 ]; then + exit 1 + fi +done + +exit 0 -- cgit