diff options
author | shishir gowda <shishirng@gluster.com> | 2010-08-30 01:36:33 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-08-30 02:52:22 -0700 |
commit | baebaab45980e63f85622e70363fe898cdc572ad (patch) | |
tree | be17d070370227989e04f5d595c295006c51dc4e /cli | |
parent | 27f39a7c9d10e836295ae4ad1a88d1f0a911079f (diff) |
Volume Add-brick validation for exports
Added checks for export already in use, duplicate exports in command,
and check whether exports are valid.
Also, cleaned up error handling in glusterd_handle_add_bricks
Signed-off-by: shishir gowda <shishirng@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 1457 (volume add brick validation for export)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1457
Diffstat (limited to 'cli')
-rw-r--r-- | cli/src/cli-cmd-parser.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index 4b8520c676b..79f56e2d4b6 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -306,6 +306,9 @@ cli_cmd_volume_add_brick_parse (const char **words, int wordcount, int brick_count = 0, brick_index = 0; int brick_list_size = 1; char brick_list[120000] = {0,}; + int j = 0; + char *tmp_list = NULL; + char *tmpptr = NULL; GF_ASSERT (words); GF_ASSERT (options); @@ -374,6 +377,19 @@ cli_cmd_volume_add_brick_parse (const char **words, int wordcount, ret = -1; goto out; } + tmp_list = strdup(brick_list+1); + j = 0; + while(( brick_count != 0) && (j < brick_count)) { + strtok_r (tmp_list, " ", &tmpptr); + if (!(strcmp (tmp_list, words[brick_index]))) { + ret = -1; + cli_out ("Found duplicate" + " exports %s",words[brick_index]); + goto out; + } + tmp_list = tmpptr; + j++; + } strcat (brick_list, words[brick_index]); strcat (brick_list, " "); |