summaryrefslogtreecommitdiffstats
path: root/extras/hook-scripts
diff options
context:
space:
mode:
authorHarshavardhana <harsha@harshavardhana.net>2014-06-29 18:56:44 -0700
committerHarshavardhana <harsha@harshavardhana.net>2014-08-07 01:17:29 -0700
commit2ec6ea43f2ddc6c00a030be6d04c00f0924277b7 (patch)
treeb2d98cd8c4760c1af44c8b6a70661fe5566ce6da /extras/hook-scripts
parentf29da9bcc812e3d0711005ce86051d70c277a165 (diff)
build: make GLUSTERD_WORKDIR rely on localstatedir
- Break-way from '/var/lib/glusterd' hard-coded previously, instead rely on 'configure' value from 'localstatedir' - Provide 's/lib/db' as default working directory for gluster management daemon for BSD and Darwin based installations - loff_t is really off_t on Darwin - fix-off the warnings generated by clang on FreeBSD/Darwin - Now 'tests/*' use GLUSTERD_WORKDIR a common variable for all platforms. - Define proper environment for running tests, define correct PATH and LD_LIBRARY_PATH when running tests, so that the desired version of glusterfs is used, regardless where it is installed. (Thanks to manu@netbsd.org for this additional work) Change-Id: I2339a0d9275de5939ccad3e52b535598064a35e7 BUG: 1111774 Signed-off-by: Harshavardhana <harsha@harshavardhana.net> Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org> Reviewed-on: http://review.gluster.org/8246 Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'extras/hook-scripts')
-rwxr-xr-xextras/hook-scripts/add-brick/post/disabled-quota-root-xattr-heal.sh44
-rwxr-xr-xextras/hook-scripts/add-brick/pre/S28Quota-enable-root-xattr-heal.sh48
-rwxr-xr-xextras/hook-scripts/reset/post/S31ganesha-reset.sh29
-rwxr-xr-xextras/hook-scripts/set/post/S30samba-set.sh42
-rwxr-xr-xextras/hook-scripts/set/post/S31ganesha-set.sh51
-rwxr-xr-xextras/hook-scripts/start/post/S30samba-start.sh33
6 files changed, 131 insertions, 116 deletions
diff --git a/extras/hook-scripts/add-brick/post/disabled-quota-root-xattr-heal.sh b/extras/hook-scripts/add-brick/post/disabled-quota-root-xattr-heal.sh
index 1866f6abd7e..d18367fc9df 100755
--- a/extras/hook-scripts/add-brick/post/disabled-quota-root-xattr-heal.sh
+++ b/extras/hook-scripts/add-brick/post/disabled-quota-root-xattr-heal.sh
@@ -18,7 +18,7 @@ PROGNAME="Quota-xattr-heal-add-brick"
VOL_NAME=
VERSION=
VOLUME_OP=
-GLUSTERD_WORKING_DIR=
+GLUSTERD_WORKDIR=
ENABLED_NAME="S28Quota-root-xattr-heal.sh"
@@ -45,33 +45,33 @@ eval set -- "$ARGS"
while true;
do
- case $1 in
+ case $1 in
--volname)
- shift
- VOL_NAME=$1
- ;;
+ shift
+ VOL_NAME=$1
+ ;;
--version)
- shift
- VERSION=$1
- ;;
- --gd-workdir)
- shift
- GLUSTERD_WORKING_DIR=$1
- ;;
- --volume-op)
- shift
- VOLUME_OP=$1
- ;;
+ shift
+ VERSION=$1
+ ;;
+ --gd-workdir)
+ shift
+ GLUSTERD_WORKDIR=$1
+ ;;
+ --volume-op)
+ shift
+ VOLUME_OP=$1
+ ;;
*)
- shift
- break
- ;;
- esac
- shift
+ shift
+ break
+ ;;
+ esac
+ shift
done
##----------------------------------------
-ENABLED_STATE="$GLUSTERD_WORKING_DIR/hooks/$VERSION/$VOLUME_OP/post/$ENABLED_NAME"
+ENABLED_STATE="$GLUSTERD_WORKDIR/hooks/$VERSION/$VOLUME_OP/post/$ENABLED_NAME"
FLAG=`gluster volume quota $VOL_NAME list / 2>&1 | grep \
diff --git a/extras/hook-scripts/add-brick/pre/S28Quota-enable-root-xattr-heal.sh b/extras/hook-scripts/add-brick/pre/S28Quota-enable-root-xattr-heal.sh
index 0801386549a..348f34ec3db 100755
--- a/extras/hook-scripts/add-brick/pre/S28Quota-enable-root-xattr-heal.sh
+++ b/extras/hook-scripts/add-brick/pre/S28Quota-enable-root-xattr-heal.sh
@@ -23,7 +23,7 @@
OPTSPEC="volname:,version:,gd-workdir:,volume-op:"
PROGNAME="Quota-xattr-heal-add-brick-pre"
VOL_NAME=
-GLUSTERD_WORKING_DIR=
+GLUSTERD_WORKDIR=
VOLUME_OP=
VERSION=
ENABLED_NAME="S28Quota-root-xattr-heal.sh"
@@ -42,35 +42,35 @@ eval set -- "$ARGS"
while true;
do
- case $1 in
+ case $1 in
--volname)
- shift
- VOL_NAME=$1
- ;;
+ shift
+ VOL_NAME=$1
+ ;;
--gd-workdir)
- shift
- GLUSTERD_WORKING_DIR=$1
- ;;
+ shift
+ GLUSTERD_WORKDIR=$1
+ ;;
--volume-op)
- shift
- VOLUME_OP=$1
- ;;
+ shift
+ VOLUME_OP=$1
+ ;;
--version)
- shift
- VERSION=$1
- ;;
+ shift
+ VERSION=$1
+ ;;
*)
- shift
- break
- ;;
- esac
- shift
+ shift
+ break
+ ;;
+ esac
+ shift
done
##----------------------------------------
-DISABLED_STATE="$GLUSTERD_WORKING_DIR/hooks/$VERSION/add-brick/post/$DISABLED_NAME"
-ENABLED_STATE_START="$GLUSTERD_WORKING_DIR/hooks/$VERSION/start/post/$ENABLED_NAME"
-ENABLED_STATE_ADD_BRICK="$GLUSTERD_WORKING_DIR/hooks/$VERSION/add-brick/post/$ENABLED_NAME";
+DISABLED_STATE="$GLUSTERD_WORKDIR/hooks/$VERSION/add-brick/post/$DISABLED_NAME"
+ENABLED_STATE_START="$GLUSTERD_WORKDIR/hooks/$VERSION/start/post/$ENABLED_NAME"
+ENABLED_STATE_ADD_BRICK="$GLUSTERD_WORKDIR/hooks/$VERSION/add-brick/post/$ENABLED_NAME";
## Why to proceed if the required script itself is not present?
ls $DISABLED_STATE;
@@ -80,7 +80,7 @@ then
fi
## Is quota enabled?
-FLAG=`cat $GLUSTERD_WORKING_DIR/vols/$VOL_NAME/info | grep "^features.quota=" \
+FLAG=`cat $GLUSTERD_WORKDIR/vols/$VOL_NAME/info | grep "^features.quota=" \
| awk -F'=' '{print $NF}'`;
if [ "$FLAG" != "on" ]
then
@@ -88,7 +88,7 @@ then
fi
## Is volume started?
-FLAG=`cat $GLUSTERD_WORKING_DIR/vols/$VOL_NAME/info | grep "^status=" \
+FLAG=`cat $GLUSTERD_WORKDIR/vols/$VOL_NAME/info | grep "^status=" \
| awk -F'=' '{print $NF}'`;
if [ "$FLAG" != "1" ]
then
diff --git a/extras/hook-scripts/reset/post/S31ganesha-reset.sh b/extras/hook-scripts/reset/post/S31ganesha-reset.sh
index a683af5c0c0..c0be3f3841d 100755
--- a/extras/hook-scripts/reset/post/S31ganesha-reset.sh
+++ b/extras/hook-scripts/reset/post/S31ganesha-reset.sh
@@ -1,27 +1,35 @@
#/bin/bash
PROGNAME="Sganesha-reset"
-OPTSPEC="volname:"
+OPTSPEC="volname:,gd-workdir:"
VOL=
+GLUSTERD_WORKDIR=
function parse_args () {
ARGS=$(getopt -l $OPTSPEC -o "o" -name $PROGNAME $@)
eval set -- "$ARGS"
- case $1 in
- --volname)
- shift
- VOL=$1
- ;;
- esac
+ while true; do
+ case $1 in
+ --volname)
+ shift
+ VOL=$1
+ ;;
+ --gd-workdir)
+ shift
+ GLUSTERD_WORKDIR=$1
+ ;;
+ esac
+ shift
+ done
}
function is_volume_started () {
volname=$1
- echo "$(grep status /var/lib/glusterd/vols/"$volname"/info |\
+ echo "$(grep status $GLUSTERD_WORKDIR/vols/"$volname"/info |\
cut -d"=" -f2)"
}
parse_args $@
-if ps aux | grep -q "[g]anesha.nfsd"
+if ps auxwww | grep -q "[g]anesha.nfsd"
then
kill -s TERM `cat /var/run/ganesha.pid`
sleep 10
@@ -33,6 +41,3 @@ if ps aux | grep -q "[g]anesha.nfsd"
gluster volume start $VOL force
fi
fi
-
-
-
diff --git a/extras/hook-scripts/set/post/S30samba-set.sh b/extras/hook-scripts/set/post/S30samba-set.sh
index 3ff368207c4..9153dcd0bb2 100755
--- a/extras/hook-scripts/set/post/S30samba-set.sh
+++ b/extras/hook-scripts/set/post/S30samba-set.sh
@@ -18,11 +18,12 @@
PROGNAME="Ssamba-set"
-OPTSPEC="volname:"
+OPTSPEC="volname:,gd-workdir:"
VOL=
CONFIGFILE=
LOGFILEBASE=
PIDDIR=
+GLUSTERD_WORKDIR=
enable_smb=""
@@ -32,29 +33,32 @@ function parse_args () {
while true; do
case $1 in
- --volname)
- shift
- VOL=$1
- ;;
- *)
- shift
- for pair in $@; do
+ --volname)
+ shift
+ VOL=$1
+ ;;
+ --gd-workdir)
+ shift
+ GLUSTERD_WORKDIR=$1
+ ;;
+ *)
+ shift
+ for pair in $@; do
read key value < <(echo "$pair" | tr "=" " ")
case "$key" in
"user.cifs")
- enable_smb=$value
- ;;
+ enable_smb=$value
+ ;;
"user.smb")
- enable_smb=$value
- ;;
+ enable_smb=$value
+ ;;
*)
- ;;
+ ;;
esac
- done
-
- shift
- break
- ;;
+ done
+ shift
+ break
+ ;;
esac
shift
done
@@ -102,7 +106,7 @@ function del_samba_share () {
function is_volume_started () {
volname=$1
- echo "$(grep status /var/lib/glusterd/vols/"$volname"/info |\
+ echo "$(grep status $GLUSTERD_WORKDIR/vols/"$volname"/info |\
cut -d"=" -f2)"
}
diff --git a/extras/hook-scripts/set/post/S31ganesha-set.sh b/extras/hook-scripts/set/post/S31ganesha-set.sh
index 972f82c5730..b09a3942a8e 100755
--- a/extras/hook-scripts/set/post/S31ganesha-set.sh
+++ b/extras/hook-scripts/set/post/S31ganesha-set.sh
@@ -1,6 +1,6 @@
#!/bin/bash
PROGNAME="Sganesha-set"
-OPTSPEC="volname:"
+OPTSPEC="volname:,gd-workdir:"
VOL=
declare -i EXPORT_ID
GANESHA_DIR="/var/lib/glusterfs-ganesha"
@@ -11,7 +11,7 @@ gnfs="enabled"
enable_ganesha=""
host_name="none"
LOC=""
-
+GLUSTERD_WORKDIR=
function parse_args ()
@@ -21,29 +21,32 @@ function parse_args ()
while true; do
case $1 in
- --volname)
- shift
- VOL=$1
- ;;
- *)
- shift
- for pair in $@; do
+ --volname)
+ shift
+ VOL=$1
+ ;;
+ --gd-workdir)
+ shift
+ GLUSTERD_WORKDIR=$1
+ ;;
+ *)
+ shift
+ for pair in $@; do
read key value < <(echo "$pair" | tr "=" " ")
case "$key" in
- "nfs-ganesha.enable")
- enable_ganesha=$value
- ;;
- "nfs-ganesha.host")
- host_name=$value
- ;;
+ "nfs-ganesha.enable")
+ enable_ganesha=$value
+ ;;
+ "nfs-ganesha.host")
+ host_name=$value
+ ;;
*)
- ;;
+ ;;
esac
- done
-
- shift
- break
- ;;
+ done
+ shift
+ break
+ ;;
esac
shift
done
@@ -52,7 +55,7 @@ function parse_args ()
function check_if_host_set()
{
- if ! cat /var/lib/glusterd/vols/$VOL/info | grep -q "nfs-ganesha.host"
+ if ! cat $GLUSTERD_WORKDIR/vols/$VOL/info | grep -q "nfs-ganesha.host"
then
exit 1
fi
@@ -71,7 +74,7 @@ function check_nfsd_loc()
function check_gluster_nfs()
{
- if cat /var/lib/glusterd/vols/$VOL/info | grep -q "nfs.disable=ON"
+ if cat $GLUSTERD_WORKDIR/vols/$VOL/info | grep -q "nfs.disable=ON"
then
gnfs="disabled"
fi
@@ -279,5 +282,3 @@ function stop_ganesha()
fi
fi
-
-
diff --git a/extras/hook-scripts/start/post/S30samba-start.sh b/extras/hook-scripts/start/post/S30samba-start.sh
index 34fde0ef8c0..43dc8e108da 100755
--- a/extras/hook-scripts/start/post/S30samba-start.sh
+++ b/extras/hook-scripts/start/post/S30samba-start.sh
@@ -21,28 +21,33 @@
#volume.
PROGNAME="Ssamba-start"
-OPTSPEC="volname:"
+OPTSPEC="volname:,gd-workdir:"
VOL=
CONFIGFILE=
LOGFILEBASE=
PIDDIR=
+GLUSTERD_WORKDIR=
function parse_args () {
ARGS=$(getopt -l $OPTSPEC -name $PROGNAME $@)
eval set -- "$ARGS"
while true; do
- case $1 in
- --volname)
- shift
- VOL=$1
- ;;
- *)
- shift
- break
- ;;
- esac
- shift
+ case $1 in
+ --volname)
+ shift
+ VOL=$1
+ ;;
+ --gd-workdir)
+ shift
+ GLUSTERD_WORKDIR=$1
+ ;;
+ *)
+ shift
+ break
+ ;;
+ esac
+ shift
done
}
@@ -85,9 +90,9 @@ function get_smb () {
volname=$1
uservalue=
- usercifsvalue=$(grep user.cifs /var/lib/glusterd/vols/"$volname"/info |\
+ usercifsvalue=$(grep user.cifs $GLUSTERD_WORKDIR/vols/"$volname"/info |\
cut -d"=" -f2)
- usersmbvalue=$(grep user.smb /var/lib/glusterd/vols/"$volname"/info |\
+ usersmbvalue=$(grep user.smb $GLUSTERD_WORKDIR/vols/"$volname"/info |\
cut -d"=" -f2)
if [[ $usercifsvalue = "disable" || $usersmbvalue = "disable" ]]; then