From 8432a5bf65174144c58d3322066abeb85c9f3541 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Mon, 6 Sep 2010 08:18:45 +0000 Subject: cli: prompt user before remove-brick and stop volume Signed-off-by: Pranith Kumar K Signed-off-by: Vijay Bellur BUG: 1538 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1538 --- cli/src/cli-cmd-volume.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'cli') 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) { -- cgit