From 1b8376013d2358a50bd7487e1abaa377d51ec4e6 Mon Sep 17 00:00:00 2001 From: Junaid Date: Mon, 30 May 2011 09:18:23 +0000 Subject: cli: Display a warning upon disabling quota. Signed-off-by: Junaid Signed-off-by: Anand Avati BUG: 2912 (Display warning upon disable quota) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2912 --- cli/src/cli-cmd-volume.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'cli/src/cli-cmd-volume.c') diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c index 467623f7320..68ac79878db 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -725,9 +725,13 @@ cli_cmd_quota_cbk (struct cli_state *state, struct cli_cmd_word *word, int ret = 0; int parse_err = 0; + int32_t type = 0; rpc_clnt_procedure_t *proc = NULL; call_frame_t *frame = NULL; dict_t *options = NULL; + gf_answer_t answer = GF_ANSWER_NO; + const char *question = "Disabling quota will delete all the quota " + "configuration. Do you want to continue?"; proc = &cli_rpc_prog->proctable[GLUSTER_CLI_QUOTA]; if (proc == NULL) { @@ -742,10 +746,15 @@ cli_cmd_quota_cbk (struct cli_state *state, struct cli_cmd_word *word, } ret = cli_cmd_quota_parse (words, wordcount, &options); - if (ret) { + if (ret < 0) { cli_usage_out (word->pattern); parse_err = 1; goto out; + } else if (dict_get_int32 (options, "type", &type) == 0 && + type == GF_QUOTA_OPTION_TYPE_DISABLE) { + answer = cli_cmd_get_confirmation (state, question); + if (answer == GF_ANSWER_NO) + goto out; } if (proc->fn) -- cgit