summaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
authorHarshavardhana <harsha@harshavardhana.net>2014-08-14 13:06:26 -0700
committerHarshavardhana <harsha@harshavardhana.net>2014-09-03 11:01:45 -0700
commit025ae07850375cbf981ed335a4ddf702d54be6e3 (patch)
treea119246764dc98f0d0c7fb87572cd1b01bc18684 /extras
parent845d6c76701a3de6a11b76b004176971411c714e (diff)
build: make GLUSTERD_WORKDIR rely on localstatedir
Backport from master branch - http://review.gluster.org/#/c/8246/ - 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: I06e684ac4c26d1e74c9daf76753403ad15f79276 BUG: 1130308 Signed-off-by: Harshavardhana <harsha@harshavardhana.net> Reviewed-on: http://review.gluster.org/8486 Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'extras')
-rw-r--r--extras/Makefile.am4
-rw-r--r--extras/geo-rep/Makefile.am2
-rw-r--r--extras/glusterd.vol.in (renamed from extras/glusterd.vol)2
-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
-rw-r--r--extras/init.d/glusterd-FreeBSD.in2
-rw-r--r--extras/systemd/glusterd.service.in4
11 files changed, 138 insertions, 123 deletions
diff --git a/extras/Makefile.am b/extras/Makefile.am
index 9395c9c1b65..74b6d17c16b 100644
--- a/extras/Makefile.am
+++ b/extras/Makefile.am
@@ -21,6 +21,6 @@ EXTRA_DIST = $(conf_DATA) specgen.scm MacOSX/Portfile glusterfs-mode.el \
command-completion/Makefile command-completion/README
install-data-local:
- $(mkdir_p) $(DESTDIR)$(localstatedir)/lib/glusterd/groups
+ $(mkdir_p) $(DESTDIR)$(GLUSTERD_WORKDIR)/groups
$(INSTALL_DATA) $(top_srcdir)/extras/group-virt.example \
- $(DESTDIR)$(localstatedir)/lib/glusterd/groups/virt
+ $(DESTDIR)$(GLUSTERD_WORKDIR)/groups/virt
diff --git a/extras/geo-rep/Makefile.am b/extras/geo-rep/Makefile.am
index 0cd6b1b7a02..6d3d10b88a0 100644
--- a/extras/geo-rep/Makefile.am
+++ b/extras/geo-rep/Makefile.am
@@ -5,7 +5,7 @@ scripts_DATA = gsync-upgrade.sh generate-gfid-file.sh get-gfid.sh \
scripts_PROGRAMS = gsync-sync-gfid
gsync_sync_gfid_CFLAGS = $(GF_CFLAGS) -Wall -I$(top_srcdir)/libglusterfs/src
gsync_sync_gfid_LDFLAGS = $(GF_LDFLAGS)
-gsync_sync_gfid_LDADD = $(GF_LIBS) $(top_builddir)/libglusterfs/src/libglusterfs.la $(GF_GLUSTERFS_LIBS)
+gsync_sync_gfid_LDADD = $(GF_LIBS) $(top_builddir)/libglusterfs/src/libglusterfs.la
gsync_sync_gfid_SOURCES = gsync-sync-gfid.c
EXTRA_DIST = gsync-sync-gfid.c gsync-upgrade.sh generate-gfid-file.sh \
diff --git a/extras/glusterd.vol b/extras/glusterd.vol.in
index fe2e3e2c772..690dbe71823 100644
--- a/extras/glusterd.vol
+++ b/extras/glusterd.vol.in
@@ -1,6 +1,6 @@
volume management
type mgmt/glusterd
- option working-directory /var/lib/glusterd
+ option working-directory @GLUSTERD_WORKDIR@
option transport-type socket,rdma
option transport.socket.keepalive-time 10
option transport.socket.keepalive-interval 2
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 4e7e7191cc2..6ee4d62debc 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
diff --git a/extras/init.d/glusterd-FreeBSD.in b/extras/init.d/glusterd-FreeBSD.in
index 5eed6360a89..21c3da72624 100644
--- a/extras/init.d/glusterd-FreeBSD.in
+++ b/extras/init.d/glusterd-FreeBSD.in
@@ -16,7 +16,7 @@ start_precmd="glusterd_prestart"
glusterd_prestart()
{
- mkdir -p /var/lib/glusterd /var/log/glusterfs
+ mkdir -p @GLUSTERD_WORKDIR@ /var/log/glusterfs
return 0
}
diff --git a/extras/systemd/glusterd.service.in b/extras/systemd/glusterd.service.in
index fc8d8c9a235..a5d260d86e7 100644
--- a/extras/systemd/glusterd.service.in
+++ b/extras/systemd/glusterd.service.in
@@ -5,9 +5,9 @@ Before=network-online.target
[Service]
Type=forking
-PIDFile=/run/glusterd.pid
+PIDFile=@localstatedir@/run/glusterd.pid
LimitNOFILE=65536
-ExecStart=@prefix@/sbin/glusterd -p /run/glusterd.pid
+ExecStart=@prefix@/sbin/glusterd -p @localstatedir@/run/glusterd.pid
KillMode=process
[Install]