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