From 386ea89d93497f805c77773515a735a11ef67f29 Mon Sep 17 00:00:00 2001 From: shishir gowda Date: Sat, 4 Sep 2010 01:12:58 +0000 Subject: 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 Signed-off-by: Vijay Bellur BUG: 1507 (need to add 'transport ' options to create brick) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1507 --- cli/src/cli-cmd-parser.c | 30 ++++++++++++++++++++++++++++++ cli/src/cli-cmd-volume.c | 3 ++- 2 files changed, 32 insertions(+), 1 deletion(-) (limited to 'cli') diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index cc14dfd34a1..f5b263a6383 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -55,6 +55,8 @@ cli_cmd_volume_create_parse (const char **words, int wordcount, dict_t **options char *host_name = NULL; char *tmp = NULL; char *freeptr = NULL; + char *trans_type = NULL; + int32_t index = 0; GF_ASSERT (words); GF_ASSERT (options); @@ -150,6 +152,32 @@ cli_cmd_volume_create_parse (const char **words, int wordcount, dict_t **options ret = dict_set_int32 (dict, "type", type); if (ret) goto out; + + if (type) + index = 5; + else + index = 3; + + if (strcasecmp(words[index], "transport") == 0) { + brick_index = index+2; + if ((strcasecmp (words[index+1], "tcp") == 0)) { + trans_type = gf_strdup ("tcp"); + } else if ((strcasecmp (words[index+1], "rdma") == 0)) { + trans_type = gf_strdup ("rdma"); + } else { + gf_log ("", GF_LOG_ERROR, "incorrect transport" + " protocol specified"); + ret = -1; + goto out; + } + } else { + trans_type = gf_strdup ("tcp"); + } + + ret = dict_set_str (dict, "transport", trans_type); + if (ret) + goto out; + strcpy (brick_list, " "); while (brick_index < wordcount) { delimiter = strchr (words[brick_index], ':'); @@ -238,6 +266,8 @@ out: if (dict) dict_destroy (dict); } + if (trans_type) + GF_FREE (trans_type); return ret; } diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c index d2820768945..09f89137445 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -121,7 +121,8 @@ void cli_cmd_volume_create_usage () { cli_out ("Usage: volume create " - "[stripe ] [replica ] ..."); + "[stripe ] [replica ] [transport ] " + " ..."); } int -- cgit