diff options
author | Krishnan Parthasarathi <kp@gluster.com> | 2012-05-03 16:29:06 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2013-01-04 08:49:43 -0800 |
commit | d3cc5862faa9ebda4d8d80f6b3e7a45c0df85c0c (patch) | |
tree | 0f646a3c2167eda09aa2c6ce699e7e42ac3b2326 /xlators/mgmt/glusterd/src/glusterd-store.c | |
parent | 129728f257bead0ce0c28b98d3989fabaebe21cd (diff) |
glusterd: Made dst brick's port info available to all peers
Change-Id: I1f65743a31d95013fdf22cded91c314e9934a3a9
BUG: 816915
Signed-off-by: Krishnan Parthasarathi <kp@gluster.com>
Reviewed-on: http://review.gluster.org/3275
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-store.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-store.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c index bb7c0a76c4a..bbca016ebbc 100644 --- a/xlators/mgmt/glusterd/src/glusterd-store.c +++ b/xlators/mgmt/glusterd/src/glusterd-store.c @@ -886,6 +886,7 @@ int32_t glusterd_store_rbstate_write (int fd, glusterd_volinfo_t *volinfo) { int ret = -1; + int port = 0; char buf[PATH_MAX] = {0, }; GF_ASSERT (fd > 0); @@ -915,11 +916,28 @@ glusterd_store_rbstate_write (int fd, glusterd_volinfo_t *volinfo) if (ret) goto out; + switch (volinfo->transport_type) { + case GF_TRANSPORT_RDMA: + port = volinfo->rep_brick.dst_brick->rdma_port; + break; + + case GF_TRANSPORT_TCP: + case GF_TRANSPORT_BOTH_TCP_RDMA: + port = volinfo->rep_brick.dst_brick->port; + break; + } + + snprintf (buf, sizeof (buf), "%d", port); + ret = glusterd_store_save_value (fd, GLUSTERD_STORE_KEY_RB_DST_PORT, + buf); + if (ret) + goto out; uuid_unparse (volinfo->rep_brick.rb_id, buf); ret = glusterd_store_save_value (fd, GF_REPLACE_BRICK_TID_KEY, buf); } + ret = 0; out: gf_log (THIS->name, GF_LOG_DEBUG, "Returning %d", ret); return ret; @@ -2177,6 +2195,20 @@ glusterd_store_retrieve_rbstate (char *volname) &volinfo->rep_brick.dst_brick); if (ret) goto out; + } else if (!strncmp (key, GLUSTERD_STORE_KEY_RB_DST_PORT, + strlen (GLUSTERD_STORE_KEY_RB_DST_PORT))) { + switch (volinfo->transport_type) { + case GF_TRANSPORT_RDMA: + volinfo->rep_brick.dst_brick->rdma_port = + atoi (value); + break; + + case GF_TRANSPORT_TCP: + case GF_TRANSPORT_BOTH_TCP_RDMA: + volinfo->rep_brick.dst_brick->port = + atoi (value); + break; + } } else if (!strncmp (key, GF_REPLACE_BRICK_TID_KEY, strlen (GF_REPLACE_BRICK_TID_KEY))) { uuid_parse (value, |