From 0bb176599a8600fa56626f808c84752d870aa6d1 Mon Sep 17 00:00:00 2001 From: Raghavendra Bhat Date: Tue, 31 Jan 2012 16:11:14 +0530 Subject: nightly_sanity: make changes to enable geo-replication and quota geo-replication and quota were not enabled during the tests, and if they were needed they had to be hardcoded in the script. Instead let the user who is running the script decide whether to enable any of them (or both of them), by giving arguments at the time of executing the script. Change-Id: I228eab1b9df4a4c261fb48c33618b9b56801a3d9 Signed-off-by: Raghavendra Bhat --- sanity/nightly_sanity/nightly_updated.sh | 49 ++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) (limited to 'sanity') diff --git a/sanity/nightly_sanity/nightly_updated.sh b/sanity/nightly_sanity/nightly_updated.sh index cb878a0..2f7ead1 100755 --- a/sanity/nightly_sanity/nightly_updated.sh +++ b/sanity/nightly_sanity/nightly_updated.sh @@ -17,8 +17,10 @@ function _init() mount_type="fuse"; fi # translator="dht"; + use_gsync="no"; + use_quota="no"; - while getopts 't:c:m:' option + while getopts 't:c:m:g:q:' option do case $option in t) @@ -30,6 +32,12 @@ function _init() m) mount_type="$OPTARG" ;; + g) + use_gsync="$OPTARG" + ;; + q) + use_quota="$OPTARG" + ;; esac done @@ -37,7 +45,15 @@ function _init() mount_type="nfs"; fi - echo "translator: $translator" && echo "mount type: $mount_type"; + if [ $use_gsync != "yes" ]; then + use_gsync="no"; + fi + + if [ $use_quota != "yes" ]; then + use_quota="no"; + fi + + echo "translator: $translator" && echo "mount type: $mount_type" && echo "gsync: $use_gsync quota: $use_quota"; sleep 1; DEFAULT_LOGDIR="/usr/local/var/log/glusterfs"; # if [ $mount_type == "fuse" ]; then @@ -53,6 +69,7 @@ function _init() WORKSPACE_DIR="/root/sanity/glusterfs.git"; WORKDIR="/export/nightly"; + GSYNC_SLAVE=$WORKDIR/gsync; SPECDIR="/opt/users/nightly_sanity/$translator"; BUILDDIR="$WORKSPACE_DIR/build"; @@ -174,6 +191,10 @@ function prepare_dirs() if [ ! -d $CORE_REPOSITORY ]; then mkdir -p $CORE_REPOSITORY; fi + + if [ ! -d $GSYNC_SLAVE ]; then + mkdir $GSYNC_SLAVE; + fi } function install_glusterfs() @@ -297,6 +318,28 @@ function start_volume() fi } +function other_volume_settings () +{ + echo "setting other volume options"; + if [ $use_gsync == "yes" ]; then + gluster volume geo-replication vol $(hostname):$GSYNC_SLAVE start || echo "starting gsync failed"; + fi + + if [ $use_quota == "yes" ]; then + gluster volume quota vol enable; + if [ $? -ne 0 ]; then + echo "enabling quota failed"; + return 2; + fi + + gluster volume quota vol limit-usage / 20GB; + if [ $? -ne 0 ]; then + echo "setting quota limit failed"; + return 2; + fi + fi +} + function mount_volume () { echo "Started the volume. Mounting it" @@ -379,6 +422,7 @@ function start_glusterfs () else echo "Mounted the volume"; fi + other_volume_settings; } @@ -505,6 +549,7 @@ function cleanup() rm -rfv $EXPORTDIR/*; rm -rfv $MOUNTDIR/client*; rm -rfv $MOUNTDIR/nfs_client* + rm -rfv $GSYNC_SLAVE/* rm -rfv /etc/glusterd; } -- cgit