summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2010-09-06 08:18:45 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-06 09:38:07 -0700
commit8432a5bf65174144c58d3322066abeb85c9f3541 (patch)
treef8dffad7b325b34a7771b25470e23f97309d4ff4 /cli
parent8d64ca70b4c2467d4ed8c76a9eae385abdebd7a7 (diff)
cli: prompt user before remove-brick and stop volume
Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1538 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1538
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-cmd-volume.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
index cbc249ba0..4dd06422a 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -246,6 +246,8 @@ cli_cmd_volume_stop_cbk (struct cli_state *state, struct cli_cmd_word *word,
call_frame_t *frame = NULL;
int flags = 0;
gf1_cli_stop_vol_req req = {0,};
+ char answer;
+ char flush;
frame = create_frame (THIS, THIS->ctx->pool);
if (!frame)
@@ -270,6 +272,17 @@ cli_cmd_volume_stop_cbk (struct cli_state *state, struct cli_cmd_word *word,
}
}
+ printf ("Stopping volume will make its data inaccessible. "
+ "Do you want to Continue? (y/n) ");
+ answer = getchar ();
+ flush = answer;
+ while ('\n' != flush)
+ flush = getchar ();
+ if ('y' != answer) {
+ ret = 0;
+ goto out;
+ }
+
req.flags = flags;
proc = &cli_rpc_prog->proctable[GF1_CLI_STOP_VOLUME];
@@ -460,6 +473,8 @@ cli_cmd_volume_remove_brick_cbk (struct cli_state *state,
rpc_clnt_procedure_t *proc = NULL;
call_frame_t *frame = NULL;
dict_t *options = NULL;
+ char answer;
+ char flush;
frame = create_frame (THIS, THIS->ctx->pool);
if (!frame)
@@ -472,6 +487,17 @@ cli_cmd_volume_remove_brick_cbk (struct cli_state *state,
goto out;
}
+ printf ("Removing brick(s) can result in data loss. "
+ "Do you want to Continue? (y/n) ");
+ answer = getchar ();
+ flush = answer;
+ while ('\n' != flush)
+ flush = getchar ();
+ if ('y' != answer) {
+ ret = 0;
+ goto out;
+ }
+
proc = &cli_rpc_prog->proctable[GF1_CLI_REMOVE_BRICK];
if (proc->fn) {