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