Blob Blame History Raw
From cbbfed8851f6241833821f3c1ee8373fd14af86f Mon Sep 17 00:00:00 2001
From: hari <hgowtham@redhat.com>
Date: Mon, 24 Oct 2016 16:24:23 +0530
Subject: [PATCH 151/157] 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 <hgowtham@redhat.com>
>Reviewed-on: http://review.gluster.org/15713
>Tested-by: hari gowtham <hari.gowtham005@gmail.com>
>Smoke: Gluster Build System <jenkins@build.gluster.org>
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
>Reviewed-by: Dan Lambright <dlambrig@redhat.com>

Change-Id: I3da929e08be2072c8e1e7259c4d7d17af8e6a643
BUG: 1388464
Signed-off-by: hari gowtham <hgowtham@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/88375
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Tested-by: Atin Mukherjee <amukherj@redhat.com>
---
 cli/src/cli-cmd-volume.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
index 2d4f465..d7037d3 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -1277,6 +1277,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 <VOLNAME> "
+                               "<start|stop|status|commit|force> is "
+                               "deprecated. Use the new command \'"
+                               "gluster volume tier <VOLNAME> detach <start|"
+                               "stop|status|commit|force>\'\n"
+                               "Do you want to Continue?";
+
+        const char *attach_question = "gluster volume attach-tier <VOLNAME> "
+                               "[<replica COUNT>] <NEW-BRICK>... is "
+                               "deprecated. Use the new command \'"
+                               "gluster volume tier <VOLNAME> attach [<replica"
+                               " COUNT>] <NEW-BRICK>... [force]\'\n"
+                               "Do you want to Continue?";
+
 
         if (wordcount < 4) {
                 cli_usage_out (word->pattern);
@@ -1286,6 +1302,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);
@@ -1311,6 +1333,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;
-- 
1.7.1