From b172bd4e3d566697003b9858487104eceff7a5bf Mon Sep 17 00:00:00 2001 From: shylesh Date: Sat, 7 Jan 2012 23:08:33 +0530 Subject: BUG:765307-check subdirectory migration Change-Id: I42355aa85fe6ee6539d9dcce86dafffc0d974758 BUG: 765307 Signed-off-by: shylesh --- dvm/765307/testcase | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100755 dvm/765307/testcase diff --git a/dvm/765307/testcase b/dvm/765307/testcase new file mode 100755 index 0000000..b00c04f --- /dev/null +++ b/dvm/765307/testcase @@ -0,0 +1,82 @@ +#!/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 -- cgit