diff options
author | Raghavendra Bhat <raghavendrabhat@gluster.com> | 2011-07-29 15:01:12 +0530 |
---|---|---|
committer | Raghavendra Bhat <raghavendrabhat@gluster.com> | 2011-07-29 15:01:12 +0530 |
commit | 1c6d9be9d25f3178dd2f688e5a4fd3d45b0ad086 (patch) | |
tree | 47c81ab726ffd37d9dc52e4b8c9f9e5c9230fd04 | |
parent | c5d8e330b532e4d2bfabba6b7170f2e5f4dc3cc3 (diff) |
script for tesing pump and replace brick operations
-rw-r--r-- | INFO | 1 | ||||
-rw-r--r-- | sanity/pump_replace_brick/verify_pump.sh | 118 |
2 files changed, 119 insertions, 0 deletions
@@ -2,6 +2,7 @@ sanity/nightly_valgrind/ ---> script used for nightly valgrind run. sanity/dev_sanity/ ---> script used for dev_sanity test. sanity/system_light/ ---> script which checks for the sanity of the filesystem by conducting tests and running tools sanity/top_profile ----> scripts for top/profile sanity +sanity/pump_replace_brick ----> scripts for testing pump xlator funtionality and replace brick operations =============================================== community-scripts/rename/ ---> few scripts which catch rename related issues in dht(note it might expose rename issues in other xlators too). diff --git a/sanity/pump_replace_brick/verify_pump.sh b/sanity/pump_replace_brick/verify_pump.sh new file mode 100644 index 0000000..446cb71 --- /dev/null +++ b/sanity/pump_replace_brick/verify_pump.sh @@ -0,0 +1,118 @@ +#!/bin/bash + +set -x + +if [ $1="" ];then + dir="/usr/local/sbin/glusterd" +else + dir=$1 +fi + +GLUSTERFSDIR=`dirname $dir` + + +function graceful_cleanup () +{ + +$GLUSTERFSDIR/gluster volume stop hosdu --mode=script +$GLUSTERFSDIR/gluster volume delete hosdu --mode=script +killall -9 glusterd +rm -rf /tmp/brick* +rm -f /tmp/tempfile +umount /tmp/mnt +rm -rf /tmp/mnt/ + +} + +function cleanup () +{ + +pgrep gluster | xargs kill -9 +rm -rf /etc/glusterd/* +rm -rf /tmp/mnt/* +umount /tmp/mnt +rm -rf /tmp/brick* + +} + +function assert_success { + if [ $1 = 0 ] ; then + echo "test passed" + else + echo "test failed" + #cleanup + exit 1 + fi +} + +function assert_are_equal { +AREQUAL='/home/arequal/arequal-checksum' +sudo rm -rf /tmp/brick{1,5}/.landfill +diff <($AREQUAL /tmp/brick1) <($AREQUAL /tmp/brick5) +assert_success $? +} + +pgrep glusterd + +if [ $? -ne 0 ];then + $GLUSTERFSDIR/glusterd -LDEBUG +fi + +$GLUSTERFSDIR/gluster volume create hosdu replica 2 $(hostname):/tmp/brick1/ $(hostname):/tmp/brick2/ $(hostname):/tmp/brick3/ $(hostname):/tmp/brick4/ 2>/dev/null 1>/dev/null; +$GLUSTERFSDIR/gluster volume set hosdu diagnostics.client-log-level DEBUG +$GLUSTERFSDIR/gluster volume set hosdu diagnostics.brick-log-level DEBUG +$GLUSTERFSDIR/gluster volume start hosdu 2>/dev/null 1>/dev/null; + +mkdir /tmp/mnt/ +mount -t glusterfs $(hostname):hosdu /tmp/mnt/ +cpwd=`pwd` +cd /tmp/mnt/ +for i in {1..40} +do + for j in {1..10} + do + dd if=/dev/urandom of=file$j bs=128K count=10 2>/dev/null 1>/dev/null + done + mkdir dir$i && cd dir$i +done + +cd $cpwd + +umount /tmp/mnt/ + +ls -l /tmp/brick1 +$GLUSTERFSDIR/gluster volume replace-brick hosdu $(hostname):/tmp/brick1/ $(hostname):/tmp/brick5/ start | grep "replace-brick started successfully" 2>/dev/null 1>/dev/null +if [ $? -ne 0 ];then + echo "Failed to start the replace-brick" + exit 1; +fi +sleep 5 + +temp=0; + +while [ $temp -eq 0 ] +do + + $GLUSTERFSDIR/gluster volume replace-brick hosdu $(hostname):/tmp/brick1/ $(hostname):/tmp/brick5/ status >/tmp/tempfile # 2>/dev/null 1>/dev/null + if [ $? -ne 0 ];then + temp=2 + fi + + grep "Migration complete" /tmp/tempfile 2>/dev/null 1>/dev/null + if [ $? -eq 0 ];then + ls -l /tmp/brick5 + assert_are_equal + temp=1; + fi +done + +if [ $temp -eq 1 ];then + echo "replace-brick operation successfull. Commiting the replace-brick" + $GLUSTERFSDIR/gluster volume replace-brick hosdu $(hostname):/tmp/brick1/ $(hostname):/tmp/brick5/ commit; + graceful_cleanup ; +elif [ $temp -eq 2 ];then + echo "Something went Bananas and glusterfsd probably crashed. Please look into it" + cleanup ; +fi +rm -f /tmp/tempfile + |