diff options
author | Vishwanath S Bhat <vishwanath@gluster.com> | 2011-07-21 15:19:14 +0530 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-07-24 11:44:42 -0700 |
commit | b06ba047f48e92323d8dc8af7ed485d35fbbccf2 (patch) | |
tree | d0fecbf395f0cb4d873e60830ffd8cdf7f41a29d /xlators/mgmt/glusterd/src/glusterd-volgen.c | |
parent | 2c068a98e4b0bf54e7553ed7411fa8c7fe3173ba (diff) |
glusterd - Removed hardcoding of transport type in replace-brick.
Replace-brick didn't support transport types other than tcp.
Test case: replace-brick should work with tcp and rdma.
Change-Id: If33f108b70247d81791d25a1a05247f49847b4d7
BUG: 3092
Reviewed-on: http://review.gluster.com/72
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Krishnan Parthasarathi <kp@gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-volgen.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volgen.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index ad8b610cc..5bd2450f0 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -1021,6 +1021,27 @@ glusterd_check_option_exists (char *key, char **completion) return ret; } +char* +glusterd_get_trans_type_rb (gf_transport_type ttype) +{ + char *trans_type = NULL; + + switch (ttype) { + case GF_TRANSPORT_RDMA: + gf_asprintf (&trans_type, "rdma"); + break; + case GF_TRANSPORT_TCP: + case GF_TRANSPORT_BOTH_TCP_RDMA: + gf_asprintf (&trans_type, "tcp"); + break; + default: + gf_log (THIS->name, GF_LOG_ERROR, "Unknown " + "transport type"); + } + + return trans_type; +} + static int volgen_graph_merge_sub (volgen_graph_t *dgraph, volgen_graph_t *sgraph) { @@ -1400,6 +1421,7 @@ server_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, xlator_t *txl = NULL; xlator_t *rbxl = NULL; char transt[16] = {0,}; + char *ptranst = NULL; char volume_id[64] = {0,}; char tstamp_file[PATH_MAX] = {0,}; int ret = 0; @@ -1459,9 +1481,16 @@ server_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, "%s-replace-brick", volname); if (!rbxl) return -1; - ret = xlator_set_option (rbxl, "transport-type", transt); + + ptranst = glusterd_get_trans_type_rb (volinfo->transport_type); + if (NULL == ptranst) + return -1; + + ret = xlator_set_option (rbxl, "transport-type", ptranst); + GF_FREE (ptranst); if (ret) return -1; + xl = volgen_graph_add_nolink (graph, "cluster/pump", "%s-pump", volname); if (!xl) |