3604df
From e8fd4f03100248175a207d5f0907a398ed992995 Mon Sep 17 00:00:00 2001
3604df
From: Atin Mukherjee <amukherj@redhat.com>
3604df
Date: Wed, 19 Oct 2016 12:53:35 +0530
3604df
Subject: [PATCH 139/141] glusterd: conditionally pass uuid for EVENT_PEER_CONNECT
3604df
3604df
When a new node is probed, on the first RPC_CLNT_CONNECT peerctx->uuid is set to
3604df
NULL as the same is yet to be populated. However the subesquent (dis)connect
3604df
events would be carrying the valid UUIDs.
3604df
3604df
Solution is not to generate EVENT_PEER_CONNECT on a peer probe trigger as CLI is
3604df
already going to take care of generating the same.
3604df
3604df
>Reviewed-on: http://review.gluster.org/15678
3604df
>Smoke: Gluster Build System <jenkins@build.gluster.org>
3604df
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
3604df
>Reviewed-by: Samikshan Bairagya <samikshan@gmail.com>
3604df
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
3604df
3604df
>Reviewed-on: http://review.gluster.org/15697
3604df
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
3604df
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
3604df
>Smoke: Gluster Build System <jenkins@build.gluster.org>
3604df
>Reviewed-by: Samikshan Bairagya <samikshan@gmail.com>
3604df
3604df
Change-Id: I2f0de054ca09f12013a6afdd8ee158c0307796b9
3604df
BUG: 1386172
3604df
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
3604df
Reviewed-on: https://code.engineering.redhat.com/gerrit/88006
3604df
---
3604df
 xlators/mgmt/glusterd/src/glusterd-handler.c |   13 ++++++++++---
3604df
 1 files changed, 10 insertions(+), 3 deletions(-)
3604df
3604df
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
3604df
index d2bb20d..417c300 100644
3604df
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
3604df
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
3604df
@@ -5751,9 +5751,16 @@ __glusterd_peer_rpc_notify (struct rpc_clnt *rpc, void *mydata,
3604df
                 peerinfo->generation = uatomic_add_return
3604df
                                                    (&conf->generation, 1);
3604df
                 peerctx->peerinfo_gen = peerinfo->generation;
3604df
-                gf_event (EVENT_PEER_CONNECT, "host=%s;uuid=%s",
3604df
-                          peerinfo->hostname, uuid_utoa (peerinfo->uuid));
3604df
-
3604df
+                /* EVENT_PEER_CONNECT will only be sent if peerctx->uuid is not
3604df
+                 * NULL, otherwise it indicates this RPC_CLNT_CONNECT is from a
3604df
+                 * peer probe trigger and given we already generate an event for
3604df
+                 * peer probe this would be unnecessary.
3604df
+                 */
3604df
+                if (!gf_uuid_is_null (peerinfo->uuid)) {
3604df
+                        gf_event (EVENT_PEER_CONNECT, "host=%s;uuid=%s",
3604df
+                                  peerinfo->hostname,
3604df
+                                  uuid_utoa (peerinfo->uuid));
3604df
+                }
3604df
                 ret = glusterd_peer_dump_version (this, rpc, peerctx);
3604df
                 if (ret)
3604df
                         gf_msg (this->name, GF_LOG_ERROR, 0,
3604df
-- 
3604df
1.7.1
3604df