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