summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c33
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c31
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.h3
3 files changed, 41 insertions, 26 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index e5aa156e1c1..230c29c47d3 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -3156,19 +3156,12 @@ rb_generate_client_volfile (glusterd_volinfo_t *volinfo,
}
GF_ASSERT (src_brickinfo->port);
- switch (volinfo->transport_type) {
- case GF_TRANSPORT_RDMA:
- ret = gf_asprintf (&ttype, "rdma");
- break;
- case GF_TRANSPORT_TCP:
- case GF_TRANSPORT_BOTH_TCP_RDMA:
- ret = gf_asprintf (&ttype, "tcp");
- default:
- gf_log (THIS->name, GF_LOG_ERROR, "Unknown "
- "transport type");
- ret = -1;
- goto out;
- }
+
+ ttype = glusterd_get_trans_type_rb (volinfo->transport_type);
+ if (NULL == ttype){
+ ret = -1;
+ goto out;
+ }
fprintf (file, client_volfile_str, src_brickinfo->hostname,
src_brickinfo->path, src_brickinfo->port, ttype);
@@ -3224,17 +3217,8 @@ rb_generate_dst_brick_volfile (glusterd_volinfo_t *volinfo,
goto out;
}
- switch (volinfo->transport_type) {
- case GF_TRANSPORT_TCP:
- case GF_TRANSPORT_BOTH_TCP_RDMA:
- ret = gf_asprintf (&trans_type, "tcp");
- break;
- case GF_TRANSPORT_RDMA:
- ret = gf_asprintf (&trans_type, "rdma");
- break;
- default:
- gf_log (THIS->name, GF_LOG_ERROR, "Unknown "
- "transport type");
+ trans_type = glusterd_get_trans_type_rb (volinfo->transport_type);
+ if (NULL == trans_type){
ret = -1;
goto out;
}
@@ -3253,6 +3237,7 @@ out:
return ret;
}
+
static int
rb_mountpoint_mkdir (glusterd_volinfo_t *volinfo,
glusterd_brickinfo_t *src_brickinfo)
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index ad8b610cc59..5bd2450f06d 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)
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.h b/xlators/mgmt/glusterd/src/glusterd-volgen.h
index f06655312b7..54ae7085c7b 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.h
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.h
@@ -66,5 +66,6 @@ gf_boolean_t
glusterd_is_valid_volfpath (char *volname, char *brick);
int generate_brick_volfiles (glusterd_volinfo_t *volinfo);
int glusterd_get_volopt_content (gf_boolean_t xml_out);
-
+char*
+glusterd_get_trans_type_rb (gf_transport_type ttype);
#endif