12a457
From c3056edcb2feae2a2d24e8d5cccfe94ae2c98903 Mon Sep 17 00:00:00 2001
12a457
From: Kaushal M <kaushal@redhat.com>
12a457
Date: Tue, 22 Mar 2016 16:32:32 +0530
12a457
Subject: [PATCH 37/80] glusterd: Add a new event to handle multi-net probes
12a457
12a457
This allows GlusterD to send updates to all other nodes when attaching
12a457
new addresses using multi-net peer probe.
12a457
12a457
Change-Id: I62846be750ab3721912e7b49656594347ea61723
12a457
BUG: 1314373
12a457
Signed-off-by: Kaushal M <kaushal@redhat.com>
12a457
Reviewed-upstream-on: http://review.gluster.org/13840
12a457
Reviewed-on: https://code.engineering.redhat.com/gerrit/71313
12a457
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
12a457
Tested-by: Atin Mukherjee <amukherj@redhat.com>
12a457
---
12a457
 xlators/mgmt/glusterd/src/glusterd-handler.c |    4 ++--
12a457
 xlators/mgmt/glusterd/src/glusterd-rpc-ops.c |    4 ++--
12a457
 xlators/mgmt/glusterd/src/glusterd-sm.c      |   12 ++++++++++++
12a457
 xlators/mgmt/glusterd/src/glusterd-sm.h      |    1 +
12a457
 4 files changed, 17 insertions(+), 4 deletions(-)
12a457
12a457
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
12a457
index 377f4f8..2b0dc9e 100644
12a457
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
12a457
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
12a457
@@ -3681,8 +3681,8 @@ glusterd_probe_begin (rpcsvc_request_t *req, const char *hoststr, int port,
12a457
                                                      _gf_false);
12a457
                 if (ret)
12a457
                         goto out;
12a457
-                //this is just to rename so inject local acc for cluster update
12a457
-                ret = glusterd_friend_sm_new_event (GD_FRIEND_EVENT_LOCAL_ACC,
12a457
+                // Injecting a NEW_NAME event to update cluster
12a457
+                ret = glusterd_friend_sm_new_event (GD_FRIEND_EVENT_NEW_NAME,
12a457
                                                     &event);
12a457
                 if (!ret) {
12a457
                         event->peername = gf_strdup (peerinfo->hostname);
12a457
diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
12a457
index 5a06455..c865261 100644
12a457
--- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
12a457
+++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
12a457
@@ -330,8 +330,8 @@ __glusterd_probe_cbk (struct rpc_req *req, struct iovec *iov,
12a457
                         goto reply;
12a457
                 }
12a457
 
12a457
-                /* Injecting LOCAL_ACC to send update */
12a457
-                ret = glusterd_friend_sm_new_event (GD_FRIEND_EVENT_LOCAL_ACC,
12a457
+                /* Injecting EVENT_NEW_NAME to send update */
12a457
+                ret = glusterd_friend_sm_new_event (GD_FRIEND_EVENT_NEW_NAME,
12a457
                                                     &event);
12a457
                 if (!ret) {
12a457
                         event->peername = gf_strdup (peerinfo->hostname);
12a457
diff --git a/xlators/mgmt/glusterd/src/glusterd-sm.c b/xlators/mgmt/glusterd/src/glusterd-sm.c
12a457
index f1bdcbd..8ae17a5 100644
12a457
--- a/xlators/mgmt/glusterd/src/glusterd-sm.c
12a457
+++ b/xlators/mgmt/glusterd/src/glusterd-sm.c
12a457
@@ -71,6 +71,7 @@ static char *glusterd_friend_sm_event_names[] = {
12a457
         "GD_FRIEND_EVENT_RCVD_REMOVE_FRIEND",
12a457
         "GD_FRIEND_EVENT_REMOVE_FRIEND",
12a457
         "GD_FRIEND_EVENT_CONNECTED",
12a457
+        "GD_FRIEND_EVENT_NEW_NAME",
12a457
         "GD_FRIEND_EVENT_MAX"
12a457
 };
12a457
 
12a457
@@ -1059,6 +1060,7 @@ glusterd_sm_t glusterd_state_default [] = {
12a457
         {GD_FRIEND_STATE_DEFAULT, glusterd_ac_none}, //EVENT_RCVD_REMOVE_FRIEND
12a457
         {GD_FRIEND_STATE_DEFAULT, glusterd_ac_friend_remove}, //EVENT_REMOVE_FRIEND
12a457
         {GD_FRIEND_STATE_DEFAULT, glusterd_ac_friend_probe}, //EVENT_CONNECTED
12a457
+        {GD_FRIEND_STATE_DEFAULT, glusterd_ac_none}, //EVENT_NEW_NAME
12a457
         {GD_FRIEND_STATE_DEFAULT, glusterd_ac_none}, //EVENT_MAX
12a457
 };
12a457
 
12a457
@@ -1075,6 +1077,7 @@ glusterd_sm_t glusterd_state_probe_rcvd [] = {
12a457
         {GD_FRIEND_STATE_DEFAULT, glusterd_ac_none}, //EVENT_RCVD_REMOVE_FRIEND
12a457
         {GD_FRIEND_STATE_DEFAULT, glusterd_ac_friend_remove}, //EVENT_REMOVE_FRIEND
12a457
         {GD_FRIEND_STATE_CONNECTED_RCVD, glusterd_ac_none}, //EVENT_CONNECTED
12a457
+        {GD_FRIEND_STATE_DEFAULT, glusterd_ac_none}, //EVENT_NEW_NAME
12a457
         {GD_FRIEND_STATE_DEFAULT, glusterd_ac_none}, //EVENT_MAX
12a457
 };
12a457
 
12a457
@@ -1091,6 +1094,7 @@ glusterd_sm_t glusterd_state_connected_rcvd [] = {
12a457
         {GD_FRIEND_STATE_DEFAULT, glusterd_ac_none}, //EVENT_RCVD_REMOVE_FRIEND
12a457
         {GD_FRIEND_STATE_DEFAULT, glusterd_ac_friend_remove}, //EVENT_REMOVE_FRIEND
12a457
         {GD_FRIEND_STATE_CONNECTED_RCVD, glusterd_ac_none}, //EVENT_CONNECTED
12a457
+        {GD_FRIEND_STATE_CONNECTED_RCVD, glusterd_ac_none}, //EVENT_NEW_NAME
12a457
         {GD_FRIEND_STATE_CONNECTED_RCVD, glusterd_ac_none}, //EVENT_MAX
12a457
 };
12a457
 
12a457
@@ -1107,6 +1111,7 @@ glusterd_sm_t glusterd_state_connected_accepted [] = {
12a457
         {GD_FRIEND_STATE_DEFAULT, glusterd_ac_none}, //EVENT_RCVD_REMOVE_FRIEND
12a457
         {GD_FRIEND_STATE_DEFAULT, glusterd_ac_friend_remove}, //EVENT_REMOVE_FRIEND
12a457
         {GD_FRIEND_STATE_CONNECTED_ACCEPTED, glusterd_ac_none}, //EVENT_CONNECTED
12a457
+        {GD_FRIEND_STATE_CONNECTED_ACCEPTED, glusterd_ac_none}, //EVENT_NEW_NAME
12a457
         {GD_FRIEND_STATE_CONNECTED_ACCEPTED, glusterd_ac_none}, //EVENT_MAX
12a457
 };
12a457
 
12a457
@@ -1123,6 +1128,7 @@ glusterd_sm_t  glusterd_state_req_sent [] = {
12a457
         {GD_FRIEND_STATE_REQ_SENT, glusterd_ac_none}, //EVENT_RCVD_REMOVE_FRIEND
12a457
         {GD_FRIEND_STATE_DEFAULT, glusterd_ac_friend_remove}, //EVENT_REMOVE_FRIEND
12a457
         {GD_FRIEND_STATE_REQ_SENT, glusterd_ac_none},//EVENT_CONNECTED
12a457
+        {GD_FRIEND_STATE_REQ_SENT, glusterd_ac_none},//EVENT_NEW_NAME
12a457
         {GD_FRIEND_STATE_REQ_SENT, glusterd_ac_none},//EVENT_MAX
12a457
 };
12a457
 
12a457
@@ -1139,6 +1145,7 @@ glusterd_sm_t  glusterd_state_req_rcvd [] = {
12a457
         {GD_FRIEND_STATE_DEFAULT, glusterd_ac_handle_friend_remove_req}, //EVENT_RCVD_REMOVE_FRIEND
12a457
         {GD_FRIEND_STATE_DEFAULT, glusterd_ac_friend_remove}, //EVENT_REMOVE_FRIEND
12a457
         {GD_FRIEND_STATE_CONNECTED_RCVD, glusterd_ac_none},//EVENT_CONNECTED
12a457
+        {GD_FRIEND_STATE_CONNECTED_RCVD, glusterd_ac_none},//EVENT_NEW_NAME
12a457
         {GD_FRIEND_STATE_REQ_RCVD, glusterd_ac_none},//EVENT_MAX
12a457
 };
12a457
 
12a457
@@ -1155,6 +1162,7 @@ glusterd_sm_t  glusterd_state_befriended [] = {
12a457
         {GD_FRIEND_STATE_DEFAULT, glusterd_ac_handle_friend_remove_req}, //EVENT_RCVD_REMOVE_FRIEND
12a457
         {GD_FRIEND_STATE_DEFAULT, glusterd_ac_friend_remove}, //EVENT_REMOVE_FRIEND
12a457
         {GD_FRIEND_STATE_BEFRIENDED, glusterd_ac_friend_add},//EVENT_CONNECTED
12a457
+        {GD_FRIEND_STATE_BEFRIENDED, glusterd_ac_send_friend_update},//EVENT_NEW_NAME
12a457
         {GD_FRIEND_STATE_BEFRIENDED, glusterd_ac_none},//EVENT_MAX
12a457
 };
12a457
 
12a457
@@ -1171,6 +1179,7 @@ glusterd_sm_t  glusterd_state_req_sent_rcvd [] = {
12a457
         {GD_FRIEND_STATE_DEFAULT, glusterd_ac_handle_friend_remove_req}, //EVENT_RCVD_REMOVE_FRIEND
12a457
         {GD_FRIEND_STATE_DEFAULT, glusterd_ac_friend_remove}, //EVENT_REMOVE_FRIEND
12a457
         {GD_FRIEND_STATE_REQ_SENT_RCVD, glusterd_ac_none},//EVENT_CONNECTED
12a457
+        {GD_FRIEND_STATE_REQ_SENT_RCVD, glusterd_ac_none},//EVENT_NEW_NAME
12a457
         {GD_FRIEND_STATE_REQ_SENT_RCVD, glusterd_ac_none},//EVENT_MAX
12a457
 };
12a457
 
12a457
@@ -1187,6 +1196,7 @@ glusterd_sm_t  glusterd_state_rejected [] = {
12a457
         {GD_FRIEND_STATE_DEFAULT, glusterd_ac_handle_friend_remove_req}, //EVENT_RCVD_REMOVE_FRIEND
12a457
         {GD_FRIEND_STATE_DEFAULT, glusterd_ac_friend_remove}, //EVENT_REMOVE_FRIEND
12a457
         {GD_FRIEND_STATE_REJECTED, glusterd_ac_friend_add},//EVENT_CONNECTED
12a457
+        {GD_FRIEND_STATE_REJECTED, glusterd_ac_none},//EVENT_NEW_NAME
12a457
         {GD_FRIEND_STATE_REQ_RCVD, glusterd_ac_none},//EVENT_MAX
12a457
 };
12a457
 
12a457
@@ -1203,6 +1213,7 @@ glusterd_sm_t  glusterd_state_req_accepted [] = {
12a457
         {GD_FRIEND_STATE_DEFAULT, glusterd_ac_handle_friend_remove_req}, //EVENT_RCVD_REMOVE_FRIEND
12a457
         {GD_FRIEND_STATE_DEFAULT, glusterd_ac_friend_remove}, //EVENT_REMOVE_FRIEND
12a457
         {GD_FRIEND_STATE_CONNECTED_ACCEPTED, glusterd_ac_reverse_probe_begin},//EVENT_CONNECTED
12a457
+        {GD_FRIEND_STATE_REQ_ACCEPTED, glusterd_ac_none},//EVENT_NEW_NAME
12a457
         {GD_FRIEND_STATE_REQ_SENT, glusterd_ac_none},//EVENT_MAX
12a457
 };
12a457
 
12a457
@@ -1219,6 +1230,7 @@ glusterd_sm_t  glusterd_state_unfriend_sent [] = {
12a457
         {GD_FRIEND_STATE_UNFRIEND_SENT, glusterd_ac_none}, //EVENT_RCVD_REMOVE_FRIEND
12a457
         {GD_FRIEND_STATE_DEFAULT, glusterd_ac_friend_remove}, //EVENT_REMOVE_FRIEND
12a457
         {GD_FRIEND_STATE_UNFRIEND_SENT, glusterd_ac_none},//EVENT_CONNECTED
12a457
+        {GD_FRIEND_STATE_UNFRIEND_SENT, glusterd_ac_none},//EVENT_NEW_NAME
12a457
         {GD_FRIEND_STATE_UNFRIEND_SENT, glusterd_ac_none},//EVENT_MAX
12a457
 };
12a457
 
12a457
diff --git a/xlators/mgmt/glusterd/src/glusterd-sm.h b/xlators/mgmt/glusterd/src/glusterd-sm.h
12a457
index 60e7514..6fff147 100644
12a457
--- a/xlators/mgmt/glusterd/src/glusterd-sm.h
12a457
+++ b/xlators/mgmt/glusterd/src/glusterd-sm.h
12a457
@@ -147,6 +147,7 @@ typedef enum glusterd_friend_sm_event_type_ {
12a457
         GD_FRIEND_EVENT_RCVD_REMOVE_FRIEND,
12a457
         GD_FRIEND_EVENT_REMOVE_FRIEND,
12a457
         GD_FRIEND_EVENT_CONNECTED,
12a457
+        GD_FRIEND_EVENT_NEW_NAME,
12a457
         GD_FRIEND_EVENT_MAX
12a457
 } glusterd_friend_sm_event_type_t;
12a457
 
12a457
-- 
12a457
1.7.1
12a457