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