cb8e9e
From ec94f1bf72f4c9dafff3897471bb819c23fc9a85 Mon Sep 17 00:00:00 2001
cb8e9e
From: Meghana M <mmadhusu@redhat.com>
cb8e9e
Date: Thu, 9 Jul 2015 03:34:07 +0530
cb8e9e
Subject: [PATCH 226/234] NFS-Ganesha : Export fails on RHEL 7.1
cb8e9e
cb8e9e
We grep for CONFFILE parameter in "/etc/syconfig/ganesha"
cb8e9e
file to find out the path of the ganesha config file.
cb8e9e
In RHEL 7.1, this parameter does not exist in the file and
cb8e9e
we can't find out the ganesha config file. Export
cb8e9e
fails invariably due to this. Changing this pattern to
cb8e9e
a more generic one and default it to "/etc/ganesha/ganesha.conf"
cb8e9e
cb8e9e
This is a backport of the fix merged upstream,
cb8e9e
http://review.gluster.org/#/c/11594/
cb8e9e
cb8e9e
Change-Id: If90dcf5d6408f7513f9c350363d4789adbc1b186
cb8e9e
BUG: 1239057
cb8e9e
Signed-off-by: Meghana Madhusudhan <mmadhusu@redhat.com>
cb8e9e
Reviewed-on: https://code.engineering.redhat.com/gerrit/52780
cb8e9e
Reviewed-by: Kaleb Keithley <kkeithle@redhat.com>
cb8e9e
Tested-by: Kaleb Keithley <kkeithle@redhat.com>
cb8e9e
---
cb8e9e
 extras/ganesha/scripts/create-export-ganesha.sh |   32 +++++++++++++++++--
cb8e9e
 extras/ganesha/scripts/dbus-send.sh             |   31 ++++++++++++++++++-
cb8e9e
 extras/ganesha/scripts/ganesha-ha.sh            |   38 ++++++++++++++++++++--
cb8e9e
 3 files changed, 93 insertions(+), 8 deletions(-)
cb8e9e
 mode change 100755 => 100644 extras/ganesha/scripts/ganesha-ha.sh
cb8e9e
cb8e9e
diff --git a/extras/ganesha/scripts/create-export-ganesha.sh b/extras/ganesha/scripts/create-export-ganesha.sh
cb8e9e
index 668f357..ab7c282 100755
cb8e9e
--- a/extras/ganesha/scripts/create-export-ganesha.sh
cb8e9e
+++ b/extras/ganesha/scripts/create-export-ganesha.sh
cb8e9e
@@ -5,8 +5,10 @@
cb8e9e
 #An export file specific to a volume
cb8e9e
 #is created in GANESHA_DIR/exports.
cb8e9e
 
cb8e9e
-GANESHA_DIR=$1
cb8e9e
+GANESHA_DIR=${1%/}
cb8e9e
 VOL=$2
cb8e9e
+CONF=
cb8e9e
+CONFFILE=
cb8e9e
 
cb8e9e
 function check_cmd_status()
cb8e9e
 {
cb8e9e
@@ -24,9 +26,33 @@ if [ ! -d "$GANESHA_DIR/exports" ];
cb8e9e
         check_cmd_status `echo $?`
cb8e9e
 fi
cb8e9e
 
cb8e9e
-CONF=$(cat /etc/sysconfig/ganesha | grep "CONFFILE" | cut -f 2 -d "=")
cb8e9e
-check_cmd_status `echo $?`
cb8e9e
+function find_rhel7_conf
cb8e9e
+{
cb8e9e
+ while [[ $# > 0 ]]
cb8e9e
+        do
cb8e9e
+                key="$1"
cb8e9e
+                case $key in
cb8e9e
+                        -f)
cb8e9e
+                         CONFFILE="$2"
cb8e9e
+                         ;;
cb8e9e
+                         *)
cb8e9e
+                         ;;
cb8e9e
+                 esac
cb8e9e
+                 shift
cb8e9e
+         done
cb8e9e
+}
cb8e9e
+
cb8e9e
+cfgline=$(grep ^CONFFILE= /etc/sysconfig/ganesha)
cb8e9e
+eval $(echo ${cfgline} | grep -F ^CONFFILE=)
cb8e9e
 
cb8e9e
+if [ -z $CONFFILE ]
cb8e9e
+        then
cb8e9e
+        cfgline=$(grep ^OPTIONS= /etc/sysconfig/ganesha)
cb8e9e
+        eval $(echo ${cfgline} | grep -F ^OPTIONS=)
cb8e9e
+        find_rhel7_conf $cfgline
cb8e9e
+
cb8e9e
+fi
cb8e9e
+CONF=${CONFFILE:-/etc/ganesha/ganesha.conf}
cb8e9e
 
cb8e9e
 function write_conf()
cb8e9e
 {
cb8e9e
diff --git a/extras/ganesha/scripts/dbus-send.sh b/extras/ganesha/scripts/dbus-send.sh
cb8e9e
index d838cab..4840be8 100755
cb8e9e
--- a/extras/ganesha/scripts/dbus-send.sh
cb8e9e
+++ b/extras/ganesha/scripts/dbus-send.sh
cb8e9e
@@ -4,8 +4,37 @@ declare -i EXPORT_ID
cb8e9e
 GANESHA_DIR=${1%/}
cb8e9e
 OPTION=$2
cb8e9e
 VOL=$3
cb8e9e
+CONF=
cb8e9e
+CONFFILE=
cb8e9e
+
cb8e9e
+function find_rhel7_conf
cb8e9e
+{
cb8e9e
+ while [[ $# > 0 ]]
cb8e9e
+        do
cb8e9e
+                key="$1"
cb8e9e
+                case $key in
cb8e9e
+                        -f)
cb8e9e
+                         CONFFILE="$2"
cb8e9e
+                         break;
cb8e9e
+                         ;;
cb8e9e
+                         *)
cb8e9e
+                         ;;
cb8e9e
+                 esac
cb8e9e
+                 shift
cb8e9e
+         done
cb8e9e
+}
cb8e9e
+
cb8e9e
 cfgline=$(grep ^CONFFILE= /etc/sysconfig/ganesha)
cb8e9e
-eval $(echo ${cfgline} | grep -F CONFFILE=)
cb8e9e
+eval $(echo ${cfgline} | grep -F ^CONFFILE=)
cb8e9e
+
cb8e9e
+if [ -z $CONFFILE ]
cb8e9e
+        then
cb8e9e
+        cfgline=$(grep ^OPTIONS= /etc/sysconfig/ganesha)
cb8e9e
+        eval $(echo ${cfgline} | grep -F ^OPTIONS=)
cb8e9e
+        find_rhel7_conf $cfgline
cb8e9e
+
cb8e9e
+fi
cb8e9e
+
cb8e9e
 CONF=${CONFFILE:-/etc/ganesha/ganesha.conf}
cb8e9e
 
cb8e9e
 function check_cmd_status()
cb8e9e
diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh
cb8e9e
old mode 100755
cb8e9e
new mode 100644
cb8e9e
index c1f0757..9e03eb6
cb8e9e
--- a/extras/ganesha/scripts/ganesha-ha.sh
cb8e9e
+++ b/extras/ganesha/scripts/ganesha-ha.sh
cb8e9e
@@ -26,13 +26,43 @@ HA_CONFDIR="/etc/ganesha"
cb8e9e
 HA_VOL_NAME="gluster_shared_storage"
cb8e9e
 HA_VOL_MNT="/var/run/gluster/shared_storage"
cb8e9e
 SERVICE_MAN="DISTRO_NOT_FOUND"
cb8e9e
-cfgline=$(grep ^CONFFILE= /etc/sysconfig/ganesha)
cb8e9e
-eval $(echo ${cfgline} | grep -F CONFFILE=)
cb8e9e
-GANESHA_CONF=${CONFFILE:-/etc/ganesha/ganesha.conf}
cb8e9e
 
cb8e9e
 RHEL6_PCS_CNAME_OPTION="--name"
cb8e9e
 SECRET_PEM="/var/lib/glusterd/nfs/secret.pem"
cb8e9e
 
cb8e9e
+GANESHA_CONF=
cb8e9e
+CONFFILE=
cb8e9e
+
cb8e9e
+function find_rhel7_conf
cb8e9e
+{
cb8e9e
+ while [[ $# > 0 ]]
cb8e9e
+        do
cb8e9e
+                key="$1"
cb8e9e
+                case $key in
cb8e9e
+                        -f)
cb8e9e
+                         CONFFILE="$2"
cb8e9e
+                         break;
cb8e9e
+                         ;;
cb8e9e
+                         *)
cb8e9e
+                         ;;
cb8e9e
+                 esac
cb8e9e
+                 shift
cb8e9e
+         done
cb8e9e
+}
cb8e9e
+
cb8e9e
+cfgline=$(grep ^CONFFILE= /etc/sysconfig/ganesha)
cb8e9e
+eval $(echo ${cfgline} | grep -F ^CONFFILE=)
cb8e9e
+
cb8e9e
+if [ -z $CONFFILE ]
cb8e9e
+        then
cb8e9e
+        cfgline=$(grep ^OPTIONS= /etc/sysconfig/ganesha)
cb8e9e
+        eval $(echo ${cfgline} | grep -F ^OPTIONS=)
cb8e9e
+        find_rhel7_conf $cfgline
cb8e9e
+
cb8e9e
+fi
cb8e9e
+
cb8e9e
+GANESHA_CONF=${CONFFILE:-/etc/ganesha/ganesha.conf}
cb8e9e
+
cb8e9e
 usage() {
cb8e9e
 
cb8e9e
         echo "Usage      : add|delete|status"
cb8e9e
@@ -823,7 +853,7 @@ main()
cb8e9e
         exit 0
cb8e9e
     fi
cb8e9e
     if [[ ${cmd} != *status ]]; then
cb8e9e
-        HA_CONFDIR=${1}; shift
cb8e9e
+        HA_CONFDIR=${1%/}; shift
cb8e9e
         local ha_conf=${HA_CONFDIR}/ganesha-ha.conf
cb8e9e
         local node=""
cb8e9e
         local vip=""
cb8e9e
-- 
cb8e9e
1.7.1
cb8e9e