summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshishir gowda <shishirng@gluster.com>2010-10-11 02:23:18 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-10-11 03:32:40 -0700
commiteb99bee0246d5a43bbee7383b3809a360aa70018 (patch)
treed529934faa9300bec7750202925cebe5ae914434
parent2eb9861cbc0387b1054bfeb7864c255a42b475f5 (diff)
Add confirmation to volume delete command
Signed-off-by: shishir gowda <shishirng@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 971 (dynamic volume management) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=971
-rw-r--r--cli/src/cli-cmd-volume.c10
-rw-r--r--cli/src/cli-cmd.h3
-rw-r--r--xlators/mgmt/glusterd/src/glusterd3_1-mops.c2
3 files changed, 14 insertions, 1 deletions
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
index 3c433c523e0..7a15f5cb356 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -234,6 +234,9 @@ cli_cmd_volume_delete_cbk (struct cli_state *state, struct cli_cmd_word *word,
rpc_clnt_procedure_t *proc = NULL;
call_frame_t *frame = NULL;
char *volname = NULL;
+ gf_answer_t answer = GF_ANSWER_NO;
+ const char *question = "Deleting volume will erase all information about the volume."
+ "Do you want to continue?";
proc = &cli_rpc_prog->proctable[GF1_CLI_DELETE_VOLUME];
@@ -246,6 +249,13 @@ cli_cmd_volume_delete_cbk (struct cli_state *state, struct cli_cmd_word *word,
goto out;
}
+ answer = cli_cmd_get_confirmation (state, question);
+
+ if (GF_ANSWER_NO == answer) {
+ ret = 0;
+ goto out;
+ }
+
volname = (char *)words[2];
if (proc->fn) {
diff --git a/cli/src/cli-cmd.h b/cli/src/cli-cmd.h
index 89fc44cfaf5..9de52436665 100644
--- a/cli/src/cli-cmd.h
+++ b/cli/src/cli-cmd.h
@@ -73,4 +73,7 @@ cli_cmd_submit (void *req, call_frame_t *frame,
int procnum, struct iobref *iobref,
cli_serialize_t sfunc, xlator_t *this,
fop_cbk_fn_t cbkfn);
+
+gf_answer_t
+cli_cmd_get_confirmation (struct cli_state *state, const char *question);
#endif /* __CLI_CMD_H__ */
diff --git a/xlators/mgmt/glusterd/src/glusterd3_1-mops.c b/xlators/mgmt/glusterd/src/glusterd3_1-mops.c
index b7ffd0dd682..fe9f4e528a0 100644
--- a/xlators/mgmt/glusterd/src/glusterd3_1-mops.c
+++ b/xlators/mgmt/glusterd/src/glusterd3_1-mops.c
@@ -1493,7 +1493,7 @@ out:
}
if (op_errstr && (strcmp (op_errstr, "")))
GF_FREE (op_errstr);
- if (!ret)
+ if (ret)
gf_log ("", GF_LOG_WARNING, "Returning %d", ret);
return ret;