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