Blob Blame History Raw
From 2b03fe928d733527f734f7f11ac3e42ea04c2293 Mon Sep 17 00:00:00 2001
From: Jiffin Tony Thottan <jthottan@redhat.com>
Date: Wed, 22 Feb 2017 14:20:41 +0530
Subject: [PATCH 400/406] glusterd/ganesha : During volume delete remove the
 ganesha export configuration file

Upstream reference :
>Change-Id: I0363e7f4d7cefd3f1b3c4f91e495767ec52e230e
>BUG: 1425723
>Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
>Reviewed-on: https://review.gluster.org/16707
>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: soumya k <skoduri@redhat.com>
>Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
>Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>

Change-Id: I0363e7f4d7cefd3f1b3c4f91e495767ec52e230e
BUG: 1395989
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/104151
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
 xlators/mgmt/glusterd/src/glusterd-ganesha.c    | 2 +-
 xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/xlators/mgmt/glusterd/src/glusterd-ganesha.c b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
index 79f8c6d..ae07eaa 100644
--- a/xlators/mgmt/glusterd/src/glusterd-ganesha.c
+++ b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
@@ -477,7 +477,7 @@ manage_export_config (char *volname, char *value, char **op_errstr)
                         CONFDIR, value, volname, NULL);
         ret = runner_run(&runner);
 
-        if (ret)
+        if (ret && !(*op_errstr))
                 gf_asprintf (op_errstr, "Failed to create"
                             " NFS-Ganesha export config file.");
 
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
index 08906ba..9e45f96 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -2813,6 +2813,14 @@ glusterd_op_delete_volume (dict_t *dict)
         if (ret)
                 goto out;
 
+        if (glusterd_check_ganesha_export (volinfo)) {
+                ret = manage_export_config (volname, "off", NULL);
+                if (ret)
+                        gf_msg (this->name, GF_LOG_WARNING, 0, 0,
+                                "Could not delete ganesha export conf file "
+                                "for %s", volname);
+        }
+
         ret = glusterd_delete_volume (volinfo);
 out:
         gf_msg_debug (this->name, 0, "returning %d", ret);
-- 
1.8.3.1