From 3ebcdf6274867e875f299c81e6fe833d7571190f Mon Sep 17 00:00:00 2001 From: Jiffin Tony Thottan Date: Thu, 5 May 2016 14:52:32 +0530 Subject: NFS-Ganesha : Parse the Export_Id correctly for unexporting volume Currently export id parsed using "cut -d ' ' -f8" which might endup in giving wrong value. In case of multiple space chracter, output may differ. In this all those instance will replaced by awk call >Change-Id: I60dea8ce116900da3c1fc9badf898e51183a2ca1 >BUG: 1333319 >Signed-off-by: Jiffin Tony Thottan >Reviewed-on: http://review.gluster.org/14225 >Smoke: Gluster Build System >NetBSD-regression: NetBSD Build System >CentOS-regression: Gluster Build System >Reviewed-by: soumya k >Reviewed-by: Kaleb KEITHLEY >(cherry picked from commit 5440bad91026f27399df51856176aef85c1fcf4d) Change-Id: I60dea8ce116900da3c1fc9badf898e51183a2ca1 BUG: 1333528 Signed-off-by: Jiffin Tony Thottan Reviewed-on: http://review.gluster.org/14231 Smoke: Gluster Build System CentOS-regression: Gluster Build System NetBSD-regression: NetBSD Build System Reviewed-by: soumya k --- extras/ganesha/scripts/create-export-ganesha.sh | 2 +- extras/ganesha/scripts/dbus-send.sh | 2 +- extras/ganesha/scripts/ganesha-ha.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/extras/ganesha/scripts/create-export-ganesha.sh b/extras/ganesha/scripts/create-export-ganesha.sh index bd884b4c4a8..c1e02d6997d 100755 --- a/extras/ganesha/scripts/create-export-ganesha.sh +++ b/extras/ganesha/scripts/create-export-ganesha.sh @@ -87,7 +87,7 @@ echo " }" } write_conf $@ > $GANESHA_DIR/exports/export.$VOL.conf -if ! (cat $CONF | grep $VOL.conf$ ) +if ! (cat $CONF | grep $VOL.conf\"$ ) then echo "%include \"$GANESHA_DIR/exports/export.$VOL.conf\"" >> $CONF fi diff --git a/extras/ganesha/scripts/dbus-send.sh b/extras/ganesha/scripts/dbus-send.sh index 87e616c23a2..9f638ca4d6b 100755 --- a/extras/ganesha/scripts/dbus-send.sh +++ b/extras/ganesha/scripts/dbus-send.sh @@ -91,7 +91,7 @@ string:"EXPORT(Path=/$VOL)" function dynamic_export_remove() { removed_id=`cat $GANESHA_DIR/exports/export.$VOL.conf |\ -grep Export_Id | cut -d ' ' -f8` +grep Export_Id | awk -F"[=,;]" '{print$2}'| tr -d '[[:space:]]'` check_cmd_status `echo $?` dbus-send --print-reply --system \ --dest=org.ganesha.nfsd /org/ganesha/nfsd/ExportMgr \ diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh index 7f1ea4c2da5..a712b270033 100644 --- a/extras/ganesha/scripts/ganesha-ha.sh +++ b/extras/ganesha/scripts/ganesha-ha.sh @@ -259,7 +259,7 @@ ${tganesha_vol_conf} removed_id=$(ssh -oPasswordAuthentication=no \ -oStrictHostKeyChecking=no -i ${SECRET_PEM} root@${current_host} \ "cat $HA_CONFDIR/exports/export.$VOL.conf |\ -grep Export_Id | cut -d ' ' -f8") +grep Export_Id | awk -F"[=,;]" '{print$2}' | tr -d '[[:space:]]'") output=$(ssh -oPasswordAuthentication=no \ -oStrictHostKeyChecking=no -i ${SECRET_PEM} root@${current_host} \ @@ -306,7 +306,7 @@ string:\"EXPORT(Path=/$VOL)\" 2>&1") # Run the same command on the localhost, removed_id=`cat $HA_CONFDIR/exports/export.$VOL.conf |\ -grep Export_Id | cut -d " " -f8` +grep Export_Id | awk -F"[=,;]" '{print$2}' | tr -d '[[:space:]]'` output=$(dbus-send --print-reply --system --dest=org.ganesha.nfsd \ /org/ganesha/nfsd/ExportMgr org.ganesha.nfsd.exportmgr.RemoveExport \ uint16:$removed_id 2>&1) -- cgit