#!/bin/bash source $cwd/regression_helpers $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 $GLUSTERFSDIR/gluster volume start $global_bug_id 2>/dev/null 1>/dev/null mount_glusterfs $global_bug_id cd $FUSE_MOUNT # Creating directory tree with depth 100 for i in {1..100} do mkdir $i cd $i touch $i done # come back to topmost directory cd $FUSE_MOUNT # replace a brick with force $GLUSTERFSDIR/gluster volume replace-brick $global_bug_id $(hostname):$EXPORT_DIR/$global_bug_id/brick2 \ $(hostname):$EXPORT_DIR/$global_bug_id/brick3 start 1>/dev/null 2>/dev/null time_out=0 status=0 while [[ $status -ne 1 && $time_out -le 300 ]] do status=$($GLUSTERFSDIR/gluster volume replace-brick $global_bug_id\ $(hostname):$EXPORT_DIR/$global_bug_id/brick2\ $(hostname):$EXPORT_DIR/$global_bug_id/brick3 status | grep 'Migration complete'|wc -l) time_out=$(( $time_out + 1)) sleep 1 done if [ $time_out -gt 300 ]; then exit 1 fi $GLUSTERFSDIR/gluster volume replace-brick $global_bug_id\ $(hostname):$EXPORT_DIR/$global_bug_id/brick2\ $(hostname):$EXPORT_DIR/$global_bug_id/brick3 commit\ |grep 'replace-brick commit successful' 1>/dev/null 2>/dev/null ret=$? if [ $ret -ne 0 ]; then exit 1 fi # unmount and mount # to see the files immediately on the mount point # otherwise some of the files shown as not present # on the replaced brick cd / umount -f $FUSE_MOUNT sleep 5 mount_glusterfs $global_bug_id sleep 5 cd $FUSE_MOUNT # now check the directories in all levels are preserved for i in {1..100} do if [ ! -d "$i" ]; then exit 1 else cd $i if [ ! -f "$i" ]; then exit 1 fi fi done exit 0