From 500813986241a8b5f6ff0658f4471a8f58e6c48e Mon Sep 17 00:00:00 2001 From: Vishwanath Date: Fri, 1 Jul 2011 07:39:21 +0000 Subject: remove hardcoding of transport type to "tcp" while generating vol files in replace-brick Please ingore previous patch for this. Please consider this one. Signed-off-by: Vishwanath S Bhat Signed-off-by: Anand Avati --- xlators/mgmt/glusterd/src/glusterd-op-sm.c | 56 ++++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 11 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 46593b1d9..831e6bbdc 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -3110,6 +3110,7 @@ static const char *client_volfile_str = "volume mnt-client\n" " option remote-host %s\n" " option remote-subvolume %s\n" " option remote-port %d\n" + " option transport-type %s\n" "end-volume\n" "volume mnt-wb\n" " type performance/write-behind\n" @@ -3120,10 +3121,11 @@ static int rb_generate_client_volfile (glusterd_volinfo_t *volinfo, glusterd_brickinfo_t *src_brickinfo) { - glusterd_conf_t *priv = NULL; - FILE *file = NULL; - char filename[PATH_MAX]; - int ret = -1; + glusterd_conf_t *priv = NULL; + FILE *file = NULL; + char filename[PATH_MAX] = {0, }; + int ret = -1; + char *ttype = NULL; priv = THIS->private; @@ -3143,11 +3145,25 @@ 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; + } fprintf (file, client_volfile_str, src_brickinfo->hostname, - src_brickinfo->path, src_brickinfo->port); + src_brickinfo->path, src_brickinfo->port, ttype); fclose (file); + GF_FREE (ttype); ret = 0; @@ -3166,7 +3182,7 @@ static const char *dst_brick_volfile_str = "volume src-posix\n" "volume src-server\n" " type protocol/server\n" " option auth.addr.%s.allow *\n" - " option transport-type tcp\n" + " option transport-type %s\n" " subvolumes %s\n" "end-volume\n"; @@ -3174,10 +3190,11 @@ static int rb_generate_dst_brick_volfile (glusterd_volinfo_t *volinfo, glusterd_brickinfo_t *dst_brickinfo) { - glusterd_conf_t *priv = NULL; - FILE *file = NULL; - char filename[PATH_MAX]; - int ret = -1; + glusterd_conf_t *priv = NULL; + FILE *file = NULL; + char filename[PATH_MAX] = {0, }; + int ret = -1; + char *trans_type = NULL; priv = THIS->private; @@ -3196,9 +3213,26 @@ 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"); + ret = -1; + goto out; + } + fprintf (file, dst_brick_volfile_str, dst_brickinfo->path, dst_brickinfo->path, dst_brickinfo->path, - dst_brickinfo->path); + trans_type, dst_brickinfo->path); + + GF_FREE (trans_type); fclose (file); -- cgit