233933
From 7a47c004b907ed5469b78d559cae6d151e4d626b Mon Sep 17 00:00:00 2001
233933
From: Jiffin Tony Thottan <jthottan@redhat.com>
233933
Date: Thu, 23 Feb 2017 16:21:52 +0530
233933
Subject: [PATCH 065/124] ganesha/scripts : remove dependency over export
233933
 configuration file for unexport
233933
233933
Currently unexport is performed by reading export id from volume configuration
233933
file. So unexport has dependency over that file. This patch will unexport with
233933
help of dbus command ShowExport. And it will only unexport the share which is
233933
added via cli.
233933
233933
Label: DOWNSTREAM ONLY
233933
233933
Change-Id: I6f3c9b2bb48f0328b18e9cc0e4b9356174afd596
233933
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
233933
Reviewed-on: https://review.gluster.org/16771
233933
Smoke: Gluster Build System <jenkins@build.gluster.org>
233933
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
233933
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
233933
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
233933
Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
233933
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
233933
Reviewed-on: https://code.engineering.redhat.com/gerrit/167150
233933
Reviewed-by: Soumya Koduri <skoduri@redhat.com>
233933
Tested-by: RHGS Build Bot <nigelb@redhat.com>
233933
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
233933
---
233933
 extras/ganesha/scripts/dbus-send.sh | 14 ++++++++++++--
233933
 1 file changed, 12 insertions(+), 2 deletions(-)
233933
233933
diff --git a/extras/ganesha/scripts/dbus-send.sh b/extras/ganesha/scripts/dbus-send.sh
233933
index ec8d948..9d613a0 100755
233933
--- a/extras/ganesha/scripts/dbus-send.sh
233933
+++ b/extras/ganesha/scripts/dbus-send.sh
233933
@@ -41,8 +41,18 @@ string:"EXPORT(Path=/$VOL)"
233933
 #This function removes an export dynamically(uses the export_id of the export)
233933
 function dynamic_export_remove()
233933
 {
233933
-        removed_id=`cat $GANESHA_DIR/exports/export.$VOL.conf |\
233933
-grep Export_Id | awk -F"[=,;]" '{print$2}'| tr -d '[[:space:]]'`
233933
+        # Below bash fetch all the export from ShowExport command and search
233933
+        # export entry based on path and then get its export entry.
233933
+        # There are two possiblities for path, either entire volume will be
233933
+        # exported or subdir. It handles both cases. But it remove only first
233933
+        # entry from the list based on assumption that entry exported via cli
233933
+        # has lowest export id value
233933
+	removed_id=$(dbus-send --type=method_call --print-reply --system \
233933
+                    --dest=org.ganesha.nfsd /org/ganesha/nfsd/ExportMgr \
233933
+                    org.ganesha.nfsd.exportmgr.ShowExports | grep -B 1 -we \
233933
+                    "/"$VOL -e "/"$VOL"/" | grep uint16 | awk '{print $2}' \
233933
+		    | head -1)
233933
+
233933
         dbus-send --print-reply --system \
233933
 --dest=org.ganesha.nfsd /org/ganesha/nfsd/ExportMgr \
233933
 org.ganesha.nfsd.exportmgr.RemoveExport uint16:$removed_id
233933
-- 
233933
1.8.3.1
233933