summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd
diff options
context:
space:
mode:
authorVishwanath <vishwanath@gluster.com>2011-07-01 07:39:21 +0000
committerAnand Avati <avati@gluster.com>2011-07-11 23:18:59 -0700
commit500813986241a8b5f6ff0658f4471a8f58e6c48e (patch)
treee744e83cb627903ba68d305823f5d531fd33be94 /xlators/mgmt/glusterd
parenta36225a984240629a906608c85a9ac7e432aacfe (diff)
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 <vishwanath@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c56
1 files changed, 45 insertions, 11 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 46593b1d9c4..831e6bbdc40 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);