From a55a780349615a0e5dc2d97fec61c143d5cd8256 Mon Sep 17 00:00:00 2001 From: hari Date: Mon, 24 Oct 2016 16:24:23 +0530 Subject: CLI/TIER: throw warning regarding the removal of the older commands. The older tier commands for attach tier and detach tier have to be removed from code. This patch sends a warning asking to use new command as older ones are depricated and will be removed. >Change-Id: Ie1c62947bad6ff106f40331ff6134838a6c72a7a >BUG: 1388062 >Signed-off-by: hari >Reviewed-on: http://review.gluster.org/15713 >Tested-by: hari gowtham >Smoke: Gluster Build System >NetBSD-regression: NetBSD Build System >CentOS-regression: Gluster Build System >Reviewed-by: Dan Lambright Change-Id: I28bcb0b0d2f362fbdd28aab9bea95e3a2947caa6 BUG: 1388470 Signed-off-by: hari Reviewed-on: http://review.gluster.org/15723 Tested-by: hari gowtham Smoke: Gluster Build System CentOS-regression: Gluster Build System NetBSD-regression: NetBSD Build System Reviewed-by: Atin Mukherjee --- cli/src/cli-cmd-volume.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c index 9b4c43e03f5..0c9400ffc29 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -1272,6 +1272,22 @@ cli_cmd_volume_tier_cbk (struct cli_state *state, int i = 0; eventtypes_t event = EVENT_LAST; gf_boolean_t aborted = _gf_false; + gf_answer_t answer = GF_ANSWER_NO; + + const char *detach_question = "gluster volume detach-tier " + " is " + "deprecated. Use the new command \'" + "gluster volume tier detach \'\n" + "Do you want to Continue?"; + + const char *attach_question = "gluster volume attach-tier " + "[] ... is " + "deprecated. Use the new command \'" + "gluster volume tier attach [] ... [force]\'\n" + "Do you want to Continue?"; + if (wordcount < 4) { cli_usage_out (word->pattern); @@ -1281,6 +1297,12 @@ cli_cmd_volume_tier_cbk (struct cli_state *state, } if (!strcmp(words[1], "detach-tier")) { + /* we need to ask question when older command is used */ + answer = cli_cmd_get_confirmation (state, detach_question); + if (GF_ANSWER_NO == answer) { + ret = 0; + goto out; + } ret = do_cli_cmd_volume_detach_tier (state, word, words, wordcount, &aborted); @@ -1306,6 +1328,12 @@ cli_cmd_volume_tier_cbk (struct cli_state *state, goto out; } else if (!strcmp(words[1], "attach-tier")) { + /* we need to ask question when the older command is used */ + answer = cli_cmd_get_confirmation (state, attach_question); + if (GF_ANSWER_NO == answer) { + ret = 0; + goto out; + } ret = do_cli_cmd_volume_attach_tier (state, word, words, wordcount); goto out; -- cgit