256ebe
From 172f32058b1a7d2e42f373490853aef5dd72f02f Mon Sep 17 00:00:00 2001
256ebe
From: Jiffin Tony Thottan <jthottan@redhat.com>
256ebe
Date: Wed, 22 Feb 2017 14:20:41 +0530
256ebe
Subject: [PATCH 058/124] glusterd/ganesha : During volume delete remove the
256ebe
 ganesha export configuration file
256ebe
256ebe
Label: DOWNSTREAM ONLY
256ebe
256ebe
Change-Id: I0363e7f4d7cefd3f1b3c4f91e495767ec52e230e
256ebe
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
256ebe
Reviewed-on: https://review.gluster.org/16707
256ebe
Smoke: Gluster Build System <jenkins@build.gluster.org>
256ebe
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
256ebe
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
256ebe
Reviewed-by: soumya k <skoduri@redhat.com>
256ebe
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
256ebe
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
256ebe
Reviewed-on: https://code.engineering.redhat.com/gerrit/167143
256ebe
Reviewed-by: Soumya Koduri <skoduri@redhat.com>
256ebe
Tested-by: RHGS Build Bot <nigelb@redhat.com>
256ebe
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
256ebe
---
256ebe
 xlators/mgmt/glusterd/src/glusterd-ganesha.c    | 2 +-
256ebe
 xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 9 +++++++++
256ebe
 2 files changed, 10 insertions(+), 1 deletion(-)
256ebe
256ebe
diff --git a/xlators/mgmt/glusterd/src/glusterd-ganesha.c b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
256ebe
index 81f794d..6d72fda 100644
256ebe
--- a/xlators/mgmt/glusterd/src/glusterd-ganesha.c
256ebe
+++ b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
256ebe
@@ -445,7 +445,7 @@ manage_export_config(char *volname, char *value, char **op_errstr)
256ebe
                     CONFDIR, value, volname, NULL);
256ebe
     ret = runner_run(&runner);
256ebe
 
256ebe
-    if (ret)
256ebe
+    if (ret && !(*op_errstr))
256ebe
         gf_asprintf(op_errstr,
256ebe
                     "Failed to create"
256ebe
                     " NFS-Ganesha export config file.");
256ebe
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
256ebe
index a0417ca..81c668c 100644
256ebe
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
256ebe
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
256ebe
@@ -2936,6 +2936,15 @@ glusterd_op_delete_volume(dict_t *dict)
256ebe
         goto out;
256ebe
     }
256ebe
 
256ebe
+    if (glusterd_check_ganesha_export(volinfo)) {
256ebe
+        ret = manage_export_config(volname, "off", NULL);
256ebe
+        if (ret)
256ebe
+            gf_msg(this->name, GF_LOG_WARNING, 0, 0,
256ebe
+                   "Could not delete ganesha export conf file "
256ebe
+                   "for %s",
256ebe
+                   volname);
256ebe
+    }
256ebe
+
256ebe
     ret = glusterd_delete_volume(volinfo);
256ebe
 out:
256ebe
     gf_msg_debug(this->name, 0, "returning %d", ret);
256ebe
-- 
256ebe
1.8.3.1
256ebe