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