summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorshishir gowda <shishirng@gluster.com>2010-09-04 01:12:58 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-06 02:21:44 -0700
commit386ea89d93497f805c77773515a735a11ef67f29 (patch)
treef9b23489dbebf33754645e27dbf5f94745aaf15a /xlators
parent4309c9b0d658185b1b7f07a98240b85870d35204 (diff)
Create volume adding transport type option rdma
Adding transport type option to cli volume create command. This is optional, and defaults to TCP. The other transport supported is rdma Signed-off-by: shishir gowda <shishirng@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1507 (need to add 'transport <type>' options to create brick) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1507
Diffstat (limited to 'xlators')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c11
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c12
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.h3
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.c14
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.h1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c14
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.h6
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 7aa7a137b48..07a7fca85fa 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 dd0214b3870..9dbd90f7641 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 0d7c1cccb30..b6d052d4100 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 3072fc92110..6e7fbd3b2c0 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 9d63fb4034f..f12cb276be4 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 cb14b853a0a..4369a4a224f 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 b7027b97ca2..ad89613fc58 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;