3604df
From cbbfed8851f6241833821f3c1ee8373fd14af86f Mon Sep 17 00:00:00 2001
3604df
From: hari <hgowtham@redhat.com>
3604df
Date: Mon, 24 Oct 2016 16:24:23 +0530
3604df
Subject: [PATCH 151/157] CLI/TIER: throw warning regarding the removal of the older commands.
3604df
3604df
The older tier commands for attach tier and detach tier have to be
3604df
removed from code. This patch sends a warning asking to use new
3604df
command as older ones are depricated and will be removed.
3604df
3604df
>Change-Id: Ie1c62947bad6ff106f40331ff6134838a6c72a7a
3604df
>BUG: 1388062
3604df
>Signed-off-by: hari <hgowtham@redhat.com>
3604df
>Reviewed-on: http://review.gluster.org/15713
3604df
>Tested-by: hari gowtham <hari.gowtham005@gmail.com>
3604df
>Smoke: Gluster Build System <jenkins@build.gluster.org>
3604df
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
3604df
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
3604df
>Reviewed-by: Dan Lambright <dlambrig@redhat.com>
3604df
3604df
Change-Id: I3da929e08be2072c8e1e7259c4d7d17af8e6a643
3604df
BUG: 1388464
3604df
Signed-off-by: hari gowtham <hgowtham@redhat.com>
3604df
Reviewed-on: https://code.engineering.redhat.com/gerrit/88375
3604df
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
3604df
Tested-by: Atin Mukherjee <amukherj@redhat.com>
3604df
---
3604df
 cli/src/cli-cmd-volume.c |   28 ++++++++++++++++++++++++++++
3604df
 1 files changed, 28 insertions(+), 0 deletions(-)
3604df
3604df
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
3604df
index 2d4f465..d7037d3 100644
3604df
--- a/cli/src/cli-cmd-volume.c
3604df
+++ b/cli/src/cli-cmd-volume.c
3604df
@@ -1277,6 +1277,22 @@ cli_cmd_volume_tier_cbk (struct cli_state *state,
3604df
         int                      i       = 0;
3604df
         eventtypes_t            event    = EVENT_LAST;
3604df
         gf_boolean_t            aborted  = _gf_false;
3604df
+        gf_answer_t             answer   = GF_ANSWER_NO;
3604df
+
3604df
+        const char *detach_question = "gluster volume detach-tier <VOLNAME> "
3604df
+                               "<start|stop|status|commit|force> is "
3604df
+                               "deprecated. Use the new command \'"
3604df
+                               "gluster volume tier <VOLNAME> detach 
3604df
+                               "stop|status|commit|force>\'\n"
3604df
+                               "Do you want to Continue?";
3604df
+
3604df
+        const char *attach_question = "gluster volume attach-tier <VOLNAME> "
3604df
+                               "[<replica COUNT>] <NEW-BRICK>... is "
3604df
+                               "deprecated. Use the new command \'"
3604df
+                               "gluster volume tier <VOLNAME> attach [
3604df
+                               " COUNT>] <NEW-BRICK>... [force]\'\n"
3604df
+                               "Do you want to Continue?";
3604df
+
3604df
 
3604df
         if (wordcount < 4) {
3604df
                 cli_usage_out (word->pattern);
3604df
@@ -1286,6 +1302,12 @@ cli_cmd_volume_tier_cbk (struct cli_state *state,
3604df
         }
3604df
 
3604df
         if (!strcmp(words[1], "detach-tier")) {
3604df
+                /* we need to ask question when older command is used */
3604df
+                answer = cli_cmd_get_confirmation (state, detach_question);
3604df
+                if (GF_ANSWER_NO == answer) {
3604df
+                        ret = 0;
3604df
+                        goto out;
3604df
+                }
3604df
                 ret = do_cli_cmd_volume_detach_tier (state, word,
3604df
                                                      words, wordcount,
3604df
                                                      &aborted);
3604df
@@ -1311,6 +1333,12 @@ cli_cmd_volume_tier_cbk (struct cli_state *state,
3604df
                 goto out;
3604df
 
3604df
         } else if (!strcmp(words[1], "attach-tier")) {
3604df
+                /* we need to ask question when the older command is used */
3604df
+                answer = cli_cmd_get_confirmation (state, attach_question);
3604df
+                if (GF_ANSWER_NO == answer) {
3604df
+                        ret = 0;
3604df
+                        goto out;
3604df
+                }
3604df
                 ret = do_cli_cmd_volume_attach_tier (state, word,
3604df
                                                      words, wordcount);
3604df
                 goto out;
3604df
-- 
3604df
1.7.1
3604df