diff options
author | Vishwanath S Bhat <vishwanath@gluster.com> | 2011-08-04 12:56:58 +0530 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-08-04 06:51:17 -0700 |
commit | e2b2ac48e3c5e38fd980344ac52f1be8658e1418 (patch) | |
tree | c29325ba7fef8b8d7370e7356ffd00222fabaae3 /xlators/mgmt/glusterd/src/glusterd-op-sm.c | |
parent | 46b84182990bc98a6fd8e1122c03e3504a5b83d2 (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-op-sm.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index e9cc4686f..785736bcc 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -2973,6 +2973,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" @@ -2983,10 +2984,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; @@ -3007,10 +3009,17 @@ rb_generate_client_volfile (glusterd_volinfo_t *volinfo, GF_ASSERT (src_brickinfo->port); + 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); + src_brickinfo->path, src_brickinfo->port, ttype); fclose (file); + GF_FREE (ttype); ret = 0; @@ -3029,7 +3038,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"; @@ -3037,10 +3046,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 *ttype = NULL; priv = THIS->private; @@ -3059,9 +3069,17 @@ rb_generate_dst_brick_volfile (glusterd_volinfo_t *volinfo, goto out; } + ttype = glusterd_get_trans_type_rb (volinfo->transport_type); + if (NULL == ttype){ + ret = -1; + goto out; + } + fprintf (file, dst_brick_volfile_str, dst_brickinfo->path, dst_brickinfo->path, dst_brickinfo->path, - dst_brickinfo->path); + ttype, dst_brickinfo->path); + + GF_FREE (ttype); fclose (file); |