diff options
Diffstat (limited to 'cli/src/cli-cmd-parser.c')
| -rw-r--r-- | cli/src/cli-cmd-parser.c | 29 | 
1 files changed, 18 insertions, 11 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index 5fdb9d08a74..de0654a744b 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -2986,12 +2986,13 @@ out:   */  int  cli_snap_create_parse (dict_t *dict, const char **words, int wordcount) { -        uint64_t        i               =        0; +        uint64_t        i               =       0;          int             ret             =       -1; -        uint64_t        volcount        =        0; -        char            key[PATH_MAX]   =        ""; +        uint64_t        volcount        =       0; +        char            key[PATH_MAX]   =       "";          char            *snapname       =       NULL; -        unsigned int    cmdi            =        2; +        unsigned int    cmdi            =       2; +        int             flags           =       0;          /* cmdi is command index, here cmdi is "2" (gluster snapshot create)*/          GF_ASSERT (words); @@ -3107,18 +3108,15 @@ cli_snap_create_parse (dict_t *dict, const char **words, int wordcount) {                   */          } -        if ((strcmp (words[i], "force") != 0)) { +        if (strcmp (words[i], "force") == 0) { +                flags = GF_CLI_FLAG_OP_FORCE; + +        } else {                  ret = -1;                  cli_err ("Invalid Syntax.");                  gf_log ("cli", GF_LOG_ERROR, "Invalid Syntax");                  goto out;          } -        ret = dict_set_int8 (dict, "snap-force", 1); -        if (ret) { -                gf_log ("cli", GF_LOG_ERROR, "Could not save " -                        "snap force option"); -                goto out; -        }          /* Check if the command has anything after "force" keyword */          if (++i < wordcount) { @@ -3130,6 +3128,15 @@ cli_snap_create_parse (dict_t *dict, const char **words, int wordcount) {          ret = 0;  out: +        if(ret == 0) { +                /*Adding force flag in either of the case i.e force set +                 * or unset*/ +                ret = dict_set_int32 (dict, "flags", flags); +                if (ret) { +                        gf_log ("cli", GF_LOG_ERROR, "Could not save " +                                "snap force option"); +                } +        }          return ret;  }  | 
