summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xextras/hook-scripts/start/post/S31ganesha-start.sh54
-rw-r--r--glusterfs.spec.in5
2 files changed, 41 insertions, 18 deletions
diff --git a/extras/hook-scripts/start/post/S31ganesha-start.sh b/extras/hook-scripts/start/post/S31ganesha-start.sh
index 9ca07e5a8d6..b85c789b9ed 100755
--- a/extras/hook-scripts/start/post/S31ganesha-start.sh
+++ b/extras/hook-scripts/start/post/S31ganesha-start.sh
@@ -103,23 +103,43 @@ function start_ganesha()
}
- parse_args $@
- is_exported="no"
- if showmount -e localhost | cut -d "" -f1 | grep -q "/$VOL[[:space:]]"
- then
- is_exported="yes"
- fi
- ganesha_value=$(grep $ganesha_key $GLUSTERD_WORKDIR/vols/$VOL/info |\
- cut -d"=" -f2)
- if [ "$ganesha_value" = "on" -a "$is_exported" = "no" ]
+# based on src/scripts/ganeshactl/Ganesha/export_mgr.py
+function is_exported()
+{
+ local volume="${1}"
+
+ dbus-send --type=method_call --print-reply --system \
+ --dest=org.ganesha.nfsd /org/ganesha/nfsd/ExportMgr \
+ org.ganesha.nfsd.exportmgr.ShowExports \
+ | grep -w -q "/${volume}"
+
+ return $?
+}
+
+# Check the info file (contains the volume options) to see if Ganesha is
+# enabled for this volume.
+function ganesha_enabled()
+{
+ local volume="${1}"
+ local info_file="${GLUSTERD_WORKDIR}/vols/${VOL}/info"
+ local enabled="off"
+
+ enabled=$(grep -w ${ganesha_key} ${info_file} | cut -d"=" -f2)
+
+ [ "${enabled}" == "on" ]
+
+ return $?
+}
+
+parse_args $@
+
+if ganesha_enabled ${VOL} && ! is_exported ${VOL}
+then
+ if [ ! -e ${GANESHA_DIR}/exports/export.${VOL}.conf ]
then
- if [ ! -e $GANESHA_DIR/exports/export.$VOL.conf ]
- then
- write_conf $VOL > $GANESHA_DIR/exports/export.$VOL.conf
- fi
- start_ganesha $VOL
- else
- exit 0
+ write_conf ${VOL} > ${GANESHA_DIR}/exports/export.${VOL}.conf
fi
+ start_ganesha ${VOL}
+fi
-
+exit 0
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index 3281ee903ee..9a7100f88dc 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -372,7 +372,7 @@ Group: Applications/File
Requires: %{name}-server = %{version}-%{release}
Requires: nfs-ganesha-gluster
-Requires: pcs
+Requires: pcs, /usr/bin/dbus-send
%description ganesha
GlusterFS is a distributed file-system capable of scaling to several
@@ -1231,6 +1231,9 @@ fi
%changelog
+* Mon Dec 28 2015 Niels de Vos <ndevos@redhat.com>
+- hook scripts in glusterfs-ganesha use dbus-send, add dependency (#1294446)
+
* Tue Dec 22 2015 Niels de Vos <ndevos@redhat.com>
- move hook scripts for nfs-ganesha to the -ganesha sub-package
- use standard 'make' installation for the hook scripts (#1174765)