Blob Blame History Raw
From 4153c6b3a334be7514b4002ca848a74e38036e72 Mon Sep 17 00:00:00 2001
From: Gaurav Yadav <gyadav@redhat.com>
Date: Mon, 13 Feb 2017 15:46:24 +0530
Subject: [PATCH 333/361] glusterd : Fix for error mesage while detaching peers

When peer is detached from a cluster, an error log is being
generated in glusterd.log -"Failed to reconfigure all daemon
services". This log is seen in the originator node where the
detach is issued.

This happens in two cases.
Case 1: Detach peer with no volume been created in cluster.
Case 2: Detach peer after deleting all the volumes which were
created but never started.
In any one of the above two cases, in glusterd_check_files_identical()
GlusterD fails to retrieve nfs-server.vol file from /var/lib/glusterd/nfs
which gets created only when a volume is in place and and is started.

With this fix both the above cases have been handled by added
validation to skip reconfigure if there is no volume in started
state.

mainline:
> BUG: 1421607
> Reviewed-on: https://review.gluster.org/16607
> 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: Atin Mukherjee <amukherj@redhat.com>
> Tested-by: Atin Mukherjee <amukherj@redhat.com>
(cherry picked from commit 9c231c845e715b5180b1b046da2cd2bde872f208)

BUG: 1383979
Change-Id: I039c0840e3d61ab54575e1e00c6a6a00874d84c0
Signed-off-by: Gaurav Yadav <gyadav@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/101314
Tested-by: Milind Changire <mchangir@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
 xlators/mgmt/glusterd/src/glusterd-nfs-svc.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c b/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c
index c6ab0c5..da34342 100644
--- a/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c
+++ b/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c
@@ -145,17 +145,32 @@ glusterd_nfssvc_reconfigure ()
         xlator_t        *this            = NULL;
         glusterd_conf_t *priv            = NULL;
         gf_boolean_t     identical       = _gf_false;
+        gf_boolean_t     vol_started     = _gf_false;
+        glusterd_volinfo_t *volinfo      = NULL;
 
         this = THIS;
         GF_VALIDATE_OR_GOTO (this->name, this, out);
 
         priv = this->private;
         GF_VALIDATE_OR_GOTO (this->name, priv, out);
+
+        cds_list_for_each_entry (volinfo, &priv->volumes, vol_list) {
+                if (GLUSTERD_STATUS_STARTED == volinfo->status) {
+                        vol_started = _gf_true;
+                        break;
+                }
+        }
+        if (!vol_started) {
+                ret = 0;
+                goto out;
+        }
+
         /*
          * Check both OLD and NEW volfiles, if they are SAME by size
          * and cksum i.e. "character-by-character". If YES, then
          * NOTHING has been changed, just return.
          */
+
         ret = glusterd_svc_check_volfile_identical (priv->nfs_svc.name,
                                                     build_nfs_graph,
                                                     &identical);
-- 
1.8.3.1