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