summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-volgen.c
diff options
context:
space:
mode:
authorVishwanath S Bhat <vishwanath@gluster.com>2011-08-04 12:56:58 +0530
committerAnand Avati <avati@gluster.com>2011-08-04 06:51:17 -0700
commite2b2ac48e3c5e38fd980344ac52f1be8658e1418 (patch)
treec29325ba7fef8b8d7370e7356ffd00222fabaae3 /xlators/mgmt/glusterd/src/glusterd-volgen.c
parent46b84182990bc98a6fd8e1122c03e3504a5b83d2 (diff)
Removes hardcoding of the transport type in replace-brick operations.
Replace-brick didn't work in volume with rdma transport type. Change-Id: Ib4654bae8aa035050f7e4718c4d29174b7db74b3 BUG: 3092 Testcase: Replace-brick should succeed in volume with rdma transport type. Reviewed-on: http://review.gluster.com/133 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.c48
1 files changed, 38 insertions, 10 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index f9c42a4618c..cc4512d821d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -1012,6 +1012,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)
{
@@ -1310,16 +1331,17 @@ static int
server_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
dict_t *set_dict, void *param)
{
- char *volname = NULL;
- char *path = NULL;
- int pump = 0;
- xlator_t *xl = NULL;
- xlator_t *txl = NULL;
- xlator_t *rbxl = NULL;
- char transt[16] = {0,};
- char volume_id[64] = {0,};
+ char *volname = NULL;
+ char *path = NULL;
+ int pump = 0;
+ xlator_t *xl = NULL;
+ 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;
+ int ret = 0;
path = param;
volname = volinfo->volname;
@@ -1357,7 +1379,13 @@ 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",