diff options
-rwxr-xr-x | helper_scripts/glusterfs-precreate.sh | 32 | ||||
-rwxr-xr-x | helper_scripts/untar-remove.sh | 103 | ||||
-rwxr-xr-x | perf-framework/create_gluster_vol | 17 | ||||
-rwxr-xr-x | perf-framework/get_date | 15 | ||||
-rwxr-xr-x | sanity/system_light/config | 2 | ||||
-rwxr-xr-x | sanity/system_light/run.sh | 11 | ||||
-rwxr-xr-x | sanity/system_light/scripts/fs_mark/fs_mark.sh | 4 | ||||
-rwxr-xr-x | sanity/system_light/scripts/fsx/fsx.sh | 1 |
8 files changed, 167 insertions, 18 deletions
diff --git a/helper_scripts/glusterfs-precreate.sh b/helper_scripts/glusterfs-precreate.sh new file mode 100755 index 0000000..c5b62a2 --- /dev/null +++ b/helper_scripts/glusterfs-precreate.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +set -e; + +if [ $# -eq 0 ]; then + echo "Usage: $0 <dir1> [dir2 [dir3 [dir4 ...]]]"; + exit 1 +fi + +for dir in "$@"; do + if [ ! -d "$dir" ]; then + echo "$0: $dir not a directory" + exit 1; + fi +done + +subdirs="{00" +for i in {1..255}; do + n=$(printf "%02x" $i); + subdirs="$subdirs,$n"; +done +subdirs="$subdirs}" + +mkdir -vp "$dir/.glusterfs"; + +for dir in $@; do + for i in {0..255}; do + n=$(printf "%02x" $i); + mkdir -vp "$dir/.glusterfs/$n" + eval "mkdir -vp $dir/.glusterfs/$n/$subdirs" + done +done
\ No newline at end of file diff --git a/helper_scripts/untar-remove.sh b/helper_scripts/untar-remove.sh new file mode 100755 index 0000000..3b7bad3 --- /dev/null +++ b/helper_scripts/untar-remove.sh @@ -0,0 +1,103 @@ +#!/bin/bash + +function _init () +{ + set -e; + + if [ $# -lt 2 ]; then + echo "Continuing tests with current working directory." + M=$PWD; + else + if [ ! -d $2 ]; then + echo "2nd argument needs to be a valid directory." + exit 42; + else + M=$2; + fi + fi + + if echo $1 | egrep -q '^[0-9]+$'; then + T=$1; + else + echo "First argument was not a number, continuing with default" + T=600; + fi + echo $T + export pid_untar; + export pid_remove; +} + +function run_tests() +{ + old_PWD=$PWD; + cd $M; + + sleep 1; + untar & + sleep 2; + remove_kernel & + + sleep $T; + + cd $old_PWD; +} + +function untar () +{ + cd $M; + while true + do + tar -xjf /opt/qa/tools/linux-2.6.31.1.tar.bz2 & + pid_untar=$!; + wait $pid_untar; + done +} + +function remove_kernel () +{ + while true + do + rm -rf $M/linux-2.6.31.1 & + pid_remove=$!; + wait $pid_remove; + done +} + +function watchdog () +{ + # insurance against hangs during the test + + sleep $1; + + echo "Kicking in watchdog after $1 secs"; +} + + +function finish () +{ + for i in $(jobs -pr) + do + echo "killing jobs" + kill -KILL $i; + sleep 2; + done + + sleep 10; + + rm -rf $M/linux-2.6.31.1 & + cleanup_remove=$!; + wait $cleanup_remove; +} + +function main () +{ + watchdog $T & + + trap finish INT EXIT; + + set -x; + + run_tests; +} + +_init "$@" && main "$@"; diff --git a/perf-framework/create_gluster_vol b/perf-framework/create_gluster_vol index fcb91ce..ce4a29e 100755 --- a/perf-framework/create_gluster_vol +++ b/perf-framework/create_gluster_vol @@ -15,6 +15,10 @@ function mgmt_vol_create() for brick in $BRICK_IP_ADDRS do ssh -l root $MGMT_NODE "$GF_BIN/gluster peer probe $brick" + if [ $? -ne 0 ]; then + echo "cluster not set up properly. Please check & restart." + exit 255; + fi done ssh -l root $MGMT_NODE "$@" ssh -l root $MGMT_NODE "$GF_BIN/gluster volume start $VOLNAME" @@ -45,22 +49,23 @@ function cleanup_brick() echo "Cleaning bricks..." for brick in $BRICK_IP_ADDRS -do +do cleanup_brick $brick & done wait -echo "Creating export directory..." +echo "Creating export directory & flushing firewall rules." for brick in $BRICK_IP_ADDRS -do +do ssh -l root $brick "mkdir -p $SERVER_EXPORT_DIR" + ssh -l root $brick "iptables -F" done # Start glusterd on all the bricks echo "Starting glusterd..." for brick in $BRICK_IP_ADDRS -do +do if [ $ENABLE_MEM_ACCT == "yes" ] then ssh -l root $brick "GLUSTERFS_DISABLE_MEM_ACCT=0 $GF_BIN/glusterd" @@ -74,7 +79,7 @@ done bricklist="" count=0 for brick in $BRICK_IP_ADDRS -do +do bricklist+="$brick:$SERVER_EXPORT_DIR " count=$((count+1)) done @@ -109,7 +114,7 @@ sleep 5 if [ $ENABLE_MEM_ACCT == "yes" ] then for brick in $BRICK_IP_ADDRS - do + do echo "Memory accounting status on : $brick -" ssh -l root $brick "\ echo \"x/x &gf_mem_acct_enable\" > gf_gdb_commands;\ diff --git a/perf-framework/get_date b/perf-framework/get_date index 335359d..6f8cb9a 100755 --- a/perf-framework/get_date +++ b/perf-framework/get_date @@ -1,5 +1,10 @@ -date +%s -ssh -l root 10.1.10.30 "date +%s" -ssh -l root 10.1.10.31 "date +%s" -ssh -l root 10.1.10.35 "date +%s" -ssh -l root 10.1.10.36 "date +%s" +#!/bin/bash + +CONFIG_FILE=gf_perf_config +source $CONFIG_FILE + +date +%s; +for brick in $BRICK_IP_ADDRS +do + ssh -l root $brick "date +%s" +done diff --git a/sanity/system_light/config b/sanity/system_light/config index 91422eb..0d95bcf 100755 --- a/sanity/system_light/config +++ b/sanity/system_light/config @@ -15,7 +15,7 @@ export DECISION="n" export TYPE="other" export TEST="all" -while getopts 'w:t:l:D' option +while getopts 'w:t:l:D:m' option do case $option in w) diff --git a/sanity/system_light/run.sh b/sanity/system_light/run.sh index 93852db..b8061c8 100755 --- a/sanity/system_light/run.sh +++ b/sanity/system_light/run.sh @@ -6,7 +6,10 @@ _init () set +x set -u; basedir=$(dirname $0); - SCRIPTS_PATH=$basedir/scripts; + name=$(basename $0); + abs=$(cd "$(dirname "$0")"; pwd) + SCRIPTS_PATH=$abs/scripts; + echo $abs; #SCRIPTS_PATH="/opt/qa/tools/system_light/scripts" CNT=0 . $basedir/config; @@ -35,17 +38,17 @@ function run_tests () CNT=$((CNT+1)) echo $CNT else - echo "$tool failed" + echo "$tool failed" | tee -a $TEST_FAIL echo $CNT fi return 0; else - echo "tool $tool is not there in the script directory. Exiting"; + echo "tool $tool is not there in the script directory $SCRIPTS_PATH. Exiting"; return 22; fi fi - for i in $(ls $SCRIPTS_PATH | sort -n) #grep "^[0-9]*$" | + for i in $(ls $SCRIPTS_PATH | sort -n) do if [ -f $SCRIPTS_PATH/$i/$i.sh ]; then run_tests $i; diff --git a/sanity/system_light/scripts/fs_mark/fs_mark.sh b/sanity/system_light/scripts/fs_mark/fs_mark.sh index 53404c5..12df22f 100755 --- a/sanity/system_light/scripts/fs_mark/fs_mark.sh +++ b/sanity/system_light/scripts/fs_mark/fs_mark.sh @@ -5,9 +5,9 @@ function main () echo "start: `date +%T`" - for i in `seq 1 6` + for i in `seq 0 6` do - time fs_mark -d . -D SUBDIR_COUNT -t THR_COUNT -S $i 2>>$LOG_FILE 1>>$LOG_FILE + time fs_mark -d . -D $SUBDIR_COUNT -t $THR_COUNT -S $i 2>>$LOG_FILE 1>>$LOG_FILE if [ $? -ne 0 ]; then echo "end:`date +%T`"; return 11; diff --git a/sanity/system_light/scripts/fsx/fsx.sh b/sanity/system_light/scripts/fsx/fsx.sh index 0d1a5e2..d76b5c4 100755 --- a/sanity/system_light/scripts/fsx/fsx.sh +++ b/sanity/system_light/scripts/fsx/fsx.sh @@ -8,6 +8,7 @@ function main () return 0; else return 1; + fi } main "$@";
\ No newline at end of file |