diff options
Diffstat (limited to 'xlators/mgmt')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handler.c | 11 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 12 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.h | 3 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-store.c | 14 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-store.h | 1 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volgen.c | 14 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd.h | 6 |
7 files changed, 59 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index 7aa7a137b..07a7fca85 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -1046,6 +1046,8 @@ glusterd_handle_create_volume (rpcsvc_request_t *req) glusterd_volinfo_t *volinfo = NULL; xlator_t *this = NULL; char *free_ptr = NULL; + char *trans_type = NULL; + GF_ASSERT (req); this = THIS; @@ -1098,6 +1100,11 @@ glusterd_handle_create_volume (rpcsvc_request_t *req) goto out; } + ret = dict_get_str (dict, "transport", &trans_type); + if (ret) { + gf_log ("", GF_LOG_ERROR, "Unable to get transport-type"); + goto out; + } ret = dict_get_str (dict, "bricks", &bricks); if (ret) { gf_log ("", GF_LOG_ERROR, "Unable to get bricks"); @@ -2587,6 +2594,10 @@ glusterd_create_volume (rpcsvc_request_t *req, dict_t *dict) if (!data) goto out; + data = dict_get (dict, "transport"); + if (!data) + goto out; + ret = glusterd_op_txn_begin (); out: diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index dd0214b38..9dbd90f76 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -990,6 +990,7 @@ glusterd_op_create_volume (gd1_mgmt_stage_op_req *req) char *free_ptr = NULL; char *saveptr = NULL; int32_t sub_count = 0; + char *trans_type = NULL; GF_ASSERT (req); @@ -1065,6 +1066,17 @@ glusterd_op_create_volume (gd1_mgmt_stage_op_req *req) goto out; } + ret = dict_get_str (dict, "transport", &trans_type); + if (ret) { + gf_log ("", GF_LOG_ERROR, "Unable to get transport"); + goto out; + } + + if (strcasecmp (trans_type, "rdma") == 0) { + volinfo->transport_type = GF_TRANSPORT_RDMA; + } else { + volinfo->transport_type = GF_TRANSPORT_TCP; + } volinfo->sub_count = sub_count; diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.h b/xlators/mgmt/glusterd/src/glusterd-op-sm.h index 0d7c1cccb..b6d052d41 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.h +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.h @@ -235,4 +235,7 @@ glusterd_op_clear_ctx_free (glusterd_op_t op); gf_boolean_t glusterd_op_get_ctx_free (glusterd_op_t op); + +int +set_xlator_option (dict_t *dict, char *key, char *value); #endif diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c index 3072fc921..6e7fbd3b2 100644 --- a/xlators/mgmt/glusterd/src/glusterd-store.c +++ b/xlators/mgmt/glusterd/src/glusterd-store.c @@ -313,6 +313,12 @@ glusterd_store_create_volume (glusterd_volinfo_t *volinfo) if (ret) goto out; + snprintf (buf, sizeof (buf), "%d", volinfo->transport_type); + ret = glusterd_store_save_value (volinfo->shandle, + GLUSTERD_STORE_KEY_VOL_TRANSPORT, buf); + if (ret) + goto out; + list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) { ret = glusterd_store_create_brick (volinfo, brickinfo); if (ret) @@ -946,6 +952,9 @@ glusterd_store_retrieve_volume (char *volname) } else if (!strncmp (key, GLUSTERD_STORE_KEY_VOL_PORT, strlen (GLUSTERD_STORE_KEY_VOL_PORT))) { volinfo->port = atoi (value); + } else if (!strncmp (key, GLUSTERD_STORE_KEY_VOL_TRANSPORT, + strlen (GLUSTERD_STORE_KEY_VOL_TRANSPORT))) { + volinfo->transport_type = atoi (value); } else { gf_log ("", GF_LOG_ERROR, "Unknown key: %s", key); @@ -1067,6 +1076,11 @@ glusterd_store_update_volume (glusterd_volinfo_t *volinfo) if (ret) goto out; + snprintf (buf, sizeof (buf), "%d", volinfo->transport_type); + ret = glusterd_store_save_value (volinfo->shandle, + GLUSTERD_STORE_KEY_VOL_TRANSPORT, buf); + if (ret) + goto out; list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) { ret = glusterd_store_create_brick (volinfo, brickinfo); diff --git a/xlators/mgmt/glusterd/src/glusterd-store.h b/xlators/mgmt/glusterd/src/glusterd-store.h index 9d63fb403..f12cb276b 100644 --- a/xlators/mgmt/glusterd/src/glusterd-store.h +++ b/xlators/mgmt/glusterd/src/glusterd-store.h @@ -47,6 +47,7 @@ #define GLUSTERD_STORE_KEY_VOL_SUB_COUNT "sub_count" #define GLUSTERD_STORE_KEY_VOL_BRICK "brick" #define GLUSTERD_STORE_KEY_VOL_VERSION "version" +#define GLUSTERD_STORE_KEY_VOL_TRANSPORT "transport-type" #define GLUSTERD_STORE_KEY_BRICK_HOSTNAME "hostname" #define GLUSTERD_STORE_KEY_BRICK_PATH "path" diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index cb14b853a..4369a4a22 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -38,7 +38,7 @@ #include "glusterd-volgen.h" #include "glusterd-utils.h" -static int +int set_xlator_option (dict_t *dict, char *key, char *value) { @@ -1904,7 +1904,17 @@ glusterd_create_volfiles (glusterd_volinfo_t *volinfo) { int ret = -1; - + if(volinfo->transport_type == GF_TRANSPORT_RDMA) { + ret = set_xlator_option (volinfo->dict, VOLGEN_CLIENT_OPTION_TRANSTYPE, + "rdma"); + ret = set_xlator_option (volinfo->dict, VOLGEN_SERVER_OPTION_TRANSTYPE, + "rdma"); + } else { + ret = set_xlator_option (volinfo->dict, VOLGEN_CLIENT_OPTION_TRANSTYPE, + "tcp"); + ret = set_xlator_option (volinfo->dict, VOLGEN_SERVER_OPTION_TRANSTYPE, + "tcp"); + } ret = generate_brick_volfiles (volinfo); if (ret) { gf_log ("", GF_LOG_DEBUG, diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h index b7027b97c..ad89613fc 100644 --- a/xlators/mgmt/glusterd/src/glusterd.h +++ b/xlators/mgmt/glusterd/src/glusterd.h @@ -114,6 +114,11 @@ struct glusterd_defrag_info_ { typedef struct glusterd_defrag_info_ glusterd_defrag_info_t; +typedef enum gf_transport_type_ { + GF_TRANSPORT_TCP, //DEFAULT + GF_TRANSPORT_RDMA, +} gf_transport_type; + struct glusterd_volinfo_ { char volname[GLUSTERD_MAX_VOLUME_NAME]; int type; @@ -134,6 +139,7 @@ struct glusterd_volinfo_ { int version; uint32_t cksum; + gf_transport_type transport_type; /* All xlator options */ dict_t *dict; |