diff options
-rw-r--r-- | cli/src/cli-cmd-parser.c | 3 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 5 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volgen.c | 78 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd.h | 1 | ||||
-rw-r--r-- | xlators/protocol/server/src/server.c | 2 |
5 files changed, 83 insertions, 6 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index 6fa1f80bd..a90e6a75e 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -170,6 +170,9 @@ cli_cmd_volume_create_parse (const char **words, int wordcount, dict_t **options trans_type = gf_strdup ("tcp"); } else if ((strcasecmp (words[index+1], "rdma") == 0)) { trans_type = gf_strdup ("rdma"); + } else if ((strcasecmp (words[index+1], "tcp,rdma") == 0) || + (strcasecmp (words[index+1], "rdma,tcp") == 0)) { + trans_type = gf_strdup ("tcp,rdma"); } else { gf_log ("", GF_LOG_ERROR, "incorrect transport" " protocol specified"); diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 89e6f47c9..501e01cfc 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -2302,9 +2302,12 @@ glusterd_op_create_volume (gd1_mgmt_stage_op_req *req, char **op_errstr) if (strcasecmp (trans_type, "rdma") == 0) { volinfo->transport_type = GF_TRANSPORT_RDMA; - } else { + } else if (strcasecmp (trans_type, "tcp") == 0) { volinfo->transport_type = GF_TRANSPORT_TCP; + } else { + volinfo->transport_type = GF_TRANSPORT_BOTH_TCP_RDMA; } + volinfo->sub_count = sub_count; if (bricks) { diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index 2933b1d8b..90b227c0e 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -907,9 +907,17 @@ build_graph_generic (glusterfs_graph_t *graph, glusterd_volinfo_t *volinfo, static void get_vol_transport_type (glusterd_volinfo_t *volinfo, char *tt) { - volinfo->transport_type == GF_TRANSPORT_RDMA ? - strcpy (tt, "rdma"): - strcpy (tt, "tcp"); + switch (volinfo->transport_type) { + case GF_TRANSPORT_RDMA: + strcpy (tt, "rdma"); + break; + case GF_TRANSPORT_TCP: + strcpy (tt, "tcp"); + break; + case GF_TRANSPORT_BOTH_TCP_RDMA: + strcpy (tt, "tcp,rdma"); + break; + } } static int @@ -1124,6 +1132,7 @@ client_graph_builder (glusterfs_graph_t *graph, glusterd_volinfo_t *volinfo, { int dist_count = 0; char transt[16] = {0,}; + char *tt = NULL; char *volname = NULL; dict_t *dict = NULL; glusterd_brickinfo_t *brick = NULL; @@ -1142,7 +1151,6 @@ client_graph_builder (glusterfs_graph_t *graph, glusterd_volinfo_t *volinfo, volname = volinfo->volname; dict = volinfo->dict; GF_ASSERT (dict); - get_vol_transport_type (volinfo, transt); if (volinfo->brick_count == 0) { gf_log ("", GF_LOG_ERROR, @@ -1161,6 +1169,12 @@ client_graph_builder (glusterfs_graph_t *graph, glusterd_volinfo_t *volinfo, return -1; } + ret = dict_get_str (set_dict, "client-transport-type", &tt); + if (ret) + get_vol_transport_type (volinfo, transt); + if (!ret) + strcpy (transt, tt); + i = 0; list_for_each_entry (brick, &volinfo->bricks, brick_list) { xl = volgen_graph_add_nolink (graph, "protocol/client", @@ -1370,6 +1384,16 @@ build_nfs_graph (glusterfs_graph_t *graph, dict_t *mod_dict) goto out; } } + + /* If both RDMA and TCP are the transport_type, use RDMA + for NFS client protocols */ + if (voliter->transport_type == GF_TRANSPORT_BOTH_TCP_RDMA) { + ret = dict_set_str (set_dict, "client-transport-type", + "rdma"); + if (ret) + goto out; + } + memset (&cgraph, 0, sizeof (cgraph)); ret = build_client_graph (&cgraph, voliter, set_dict); if (ret) @@ -1528,21 +1552,65 @@ get_client_filepath (char *filename, glusterd_volinfo_t *volinfo) path, volinfo->volname); } +static void +get_rdma_client_filepath (char *filename, glusterd_volinfo_t *volinfo) +{ + char path[PATH_MAX] = {0,}; + glusterd_conf_t *priv = NULL; + + priv = THIS->private; + + GLUSTERD_GET_VOLUME_DIR (path, volinfo, priv); + + snprintf (filename, PATH_MAX, "%s/%s-rdma-fuse.vol", + path, volinfo->volname); +} + static int generate_client_volfile (glusterd_volinfo_t *volinfo) { glusterfs_graph_t graph = {{0,},}; char filename[PATH_MAX] = {0,}; int ret = -1; + dict_t *dict = NULL; get_client_filepath (filename, volinfo); - ret = build_client_graph (&graph, volinfo, NULL); + if (volinfo->transport_type == GF_TRANSPORT_BOTH_TCP_RDMA) { + dict = dict_new (); + if (!dict) + goto out; + ret = dict_set_str (dict, "client-transport-type", "tcp"); + if (ret) + goto out; + } + + ret = build_client_graph (&graph, volinfo, dict); if (!ret) ret = volgen_write_volfile (&graph, filename); volgen_graph_free (&graph); + if (dict) { + /* This means, transport type is both RDMA and TCP */ + + memset (&graph, 0, sizeof (graph)); + get_rdma_client_filepath (filename, volinfo); + + ret = dict_set_str (dict, "client-transport-type", "rdma"); + if (ret) + goto out; + + ret = build_client_graph (&graph, volinfo, dict); + if (!ret) + ret = volgen_write_volfile (&graph, filename); + + volgen_graph_free (&graph); + + dict_unref (dict); + } + +out: return ret; } diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h index 43a14f297..aca7b7dc7 100644 --- a/xlators/mgmt/glusterd/src/glusterd.h +++ b/xlators/mgmt/glusterd/src/glusterd.h @@ -155,6 +155,7 @@ typedef struct glusterd_defrag_info_ glusterd_defrag_info_t; typedef enum gf_transport_type_ { GF_TRANSPORT_TCP, //DEFAULT GF_TRANSPORT_RDMA, + GF_TRANSPORT_BOTH_TCP_RDMA, } gf_transport_type; diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c index 7c92441ea..87e78880f 100644 --- a/xlators/protocol/server/src/server.c +++ b/xlators/protocol/server/src/server.c @@ -829,6 +829,8 @@ struct volume_options options[] = { .value = {"rpc", "rpc-over-rdma", "tcp", "socket", "ib-verbs", "unix", "ib-sdp", "tcp/server", "ib-verbs/server", "rdma", "rdma*([ \t]),*([ \t])socket", + "rdma*([ \t]),*([ \t])tcp", + "tcp*([ \t]),*([ \t])rdma", "socket*([ \t]),*([ \t])rdma"}, .type = GF_OPTION_TYPE_STR }, |