diff options
Diffstat (limited to 'cli/src/cli-cmd-parser.c')
-rw-r--r-- | cli/src/cli-cmd-parser.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index 44c497977..2b0633eeb 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -3164,7 +3164,8 @@ out: } int32_t -cli_snap_config_parse (const char **words, int wordcount, dict_t *options) +cli_snap_config_parse (const char **words, int wordcount, dict_t *options, + struct cli_state *state) { char *volname = NULL; int ret = -1; @@ -3172,9 +3173,16 @@ cli_snap_config_parse (const char **words, int wordcount, dict_t *options) char *value = NULL; uint64_t limit = 0; gf1_cli_snapshot type = GF_SNAP_OPTION_TYPE_NONE; + gf_answer_t answer = GF_ANSWER_NO; + const char *question = "Changing snapshot-max-limit" + " will lead deletion of snap" + "shots if they exceed the " + "new limit.\nDo you want to" + " continue?"; GF_ASSERT (words); GF_ASSERT (options); + GF_ASSERT (state); if ((wordcount != 3) && (wordcount != 5)) goto out; @@ -3234,6 +3242,12 @@ cli_snap_config_parse (const char **words, int wordcount, dict_t *options) if (ret) goto out; + answer = cli_cmd_get_confirmation (state, question); + + if (GF_ANSWER_NO == answer) { + ret = -1; + goto out; + } out: return ret; } @@ -3338,7 +3352,8 @@ out: int32_t -cli_cmd_snapshot_parse (const char **words, int wordcount, dict_t **options) +cli_cmd_snapshot_parse (const char **words, int wordcount, dict_t **options, + struct cli_state *state) { int32_t ret = -1; dict_t *dict = NULL; @@ -3352,6 +3367,7 @@ cli_cmd_snapshot_parse (const char **words, int wordcount, dict_t **options) GF_ASSERT (words); GF_ASSERT (options); + GF_ASSERT (state); dict = dict_new (); if (!dict) @@ -3451,7 +3467,12 @@ cli_cmd_snapshot_parse (const char **words, int wordcount, dict_t **options) type = GF_SNAP_OPTION_TYPE_CONFIG; - ret = cli_snap_config_parse (words, wordcount, dict); + ret = cli_snap_config_parse (words, wordcount, dict, state); + if (ret) { + gf_log ("", GF_LOG_ERROR, + "config command parsing failed."); + goto out; + } } else { gf_log ("", GF_LOG_ERROR, "Opword Mismatch"); goto out; |