diff options
| author | shishir gowda <shishirng@gluster.com> | 2010-08-26 04:10:19 +0000 | 
|---|---|---|
| committer | Anand V. Avati <avati@dev.gluster.com> | 2010-08-26 07:31:02 -0700 | 
| commit | af7b57b3099d07be2469895e4c83e3fa4442777e (patch) | |
| tree | eb691f0124bf9824d4126d16ab395e7f1d543db6 /cli/src | |
| parent | d36c42a35fcc95468d692e5e7dd00fa7ca17b653 (diff) | |
Cli volume create detect dup bricks
Signed-off-by: shishir gowda <shishirng@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 1184 ()
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1184
Diffstat (limited to 'cli/src')
| -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 f914e4e522e..d8464067dcd 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -48,6 +48,9 @@ cli_cmd_volume_create_parse (const char **words, int wordcount, dict_t **options          int     brick_list_size = 1;          char    brick_list[120000] = {0,};          int     i = 0; +        char    *tmp_list = NULL; +        char    *tmpptr = NULL; +        int     j = 0;          GF_ASSERT (words);          GF_ASSERT (options); @@ -159,6 +162,19 @@ cli_cmd_volume_create_parse (const char **words, int wordcount, dict_t **options                          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, " ");                  brick_list_size += (strlen (words[brick_index]) + 1); | 
