#!/bin/bash source $cwd/regression_helpers BRICK1=$(hostname):$EXPORT_DIR/$global_bug_id/brick1 BRICK2=$(hostname):$EXPORT_DIR/$global_bug_id/brick2 $GLUSTERFSDIR/gluster volume create $global_bug_id $BRICK1 1>/dev/null 2>/dev/null $GLUSTERFSDIR/gluster volume start $global_bug_id 2>/dev/null 1>/dev/null sleep 5 mount_glusterfs $global_bug_id cd $FUSE_MOUNT for i in {1..10} do touch $i done # Capture the GFIDs of all the files cd $EXPORT_DIR/$global_bug_id/brick1 for i in {1..10} do GFID_ARR[$i]=$(getfattr -d -e hex -n trusted.gfid -m . $i | grep trusted.gfid| cut -d "=" -f2) done $GLUSTERFSDIR/gluster volume add-brick $global_bug_id $BRICK2 1>/dev/null 2>/dev/null $GLUSTERFSDIR/gluster volume rebalance $global_bug_id start 1>/dev/null 2>/dev/null sleep 2 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 # now compare the GFIDs of all the files # with the previously stored for i in {1..10} do if [ -f "$EXPORT_DIR/$global_bug_id/brick1/$i" ] ; then GFID_ARR2[$i]=$(getfattr -d -e hex -n trusted.gfid -m . $EXPORT_DIR/$global_bug_id/brick1/$i 2>/dev/null\ | grep trusted.gfid | cut -d "=" -f2) if [ ${GFID_ARR[$i]} != ${GFID_ARR2[$i]} ]; then exit 1 fi elif [ -f "$EXPORT_DIR/$global_bug_id/brick2/$i" ]; then GFID_ARR2[$i]=$(getfattr -d -e hex -n trusted.gfid -m . $EXPORT_DIR/$global_bug_id/brick2/$i 2>/dev/null\ | grep trusted.gfid | cut -d "=" -f2) if [ ${GFID_ARR[$i]} != ${GFID_ARR2[$i]} ]; then exit 1 fi else echo "file not found" exit 1 fi done exit 0