summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhari gowtham <hgowtham@redhat.com>2017-01-24 14:24:47 +0530
committerShyamsundar Ranganathan <srangana@redhat.com>2017-02-07 09:28:39 -0500
commitc13a39e6c425622221226e5a3c49aafbf430a07d (patch)
tree683774fc221154553a20f554e93cef974569ee86
parentb1d35c6fbaf5e0e958c69ec9c99a5d87649e52bb (diff)
CLI/TIER: removing old tier commands under rebalance
back-port of : https://review.gluster.org/#/c/16463/ PROBLEM: gluster v rebalance <volname> tier start works even after the switch of tier to service framework. This lets the user have two tierd for the same volume. FIX: checking for each process will make the new code hard to maintain. So we are removing the support for old commands. >Change-Id: I5b0974b2dbb74f0bee8344b61c7f924300ad73f2 >BUG: 1415590 >Signed-off-by: hari gowtham <hgowtham@redhat.com> >Reviewed-on: https://review.gluster.org/16463 >Smoke: Gluster Build System <jenkins@build.gluster.org> >Tested-by: hari gowtham <hari.gowtham005@gmail.com> >NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> >CentOS-regression: Gluster Build System <jenkins@build.gluster.org> >Reviewed-by: N Balachandran <nbalacha@redhat.com> >Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Change-Id: Ib996d89b1bd250176a3f5eeb369b71b0a4f95968 BUG: 1419868 Signed-off-by: hari gowtham <hgowtham@redhat.com> Reviewed-on: https://review.gluster.org/16555 Smoke: Gluster Build System <jenkins@build.gluster.org> Tested-by: hari gowtham <hari.gowtham005@gmail.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Atin Mukherjee <amukherj@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
-rw-r--r--cli/src/cli-cmd-parser.c60
-rw-r--r--cli/src/cli-rpc-ops.c12
-rw-r--r--cli/src/cli.h4
-rw-r--r--tests/basic/tier/new-tier-cmds.t17
4 files changed, 75 insertions, 18 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index 3cc6ca97d37..9b1f1db88e8 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -3963,6 +3963,56 @@ out:
}
int
+cli_cmd_volume_old_tier_parse (const char **words, int wordcount,
+ dict_t **options)
+{
+ dict_t *dict = NULL;
+ int ret = -1;
+ char *volname = NULL;
+ gf_cli_defrag_type cmd = 0;
+
+ GF_ASSERT (words);
+ GF_ASSERT (options);
+
+ dict = dict_new ();
+ if (!dict)
+ goto out;
+
+ if (wordcount != 4)
+ goto out;
+
+ if ((strcmp (words[1], "tier") == 0) &&
+ (strcmp (words[3], "start") == 0)) {
+ cmd = GF_DEFRAG_CMD_START_TIER;
+ } else
+ goto out;
+
+ volname = (char *) words[2];
+
+ ret = dict_set_str (dict, "volname", volname);
+
+ if (ret) {
+ gf_log (THIS->name, GF_LOG_ERROR, "failed to set dict");
+ goto out;
+ }
+
+ ret = dict_set_int32 (dict, "rebalance-command", (int32_t) cmd);
+
+ if (ret) {
+ gf_log (THIS->name, GF_LOG_ERROR, "failed to set dict");
+ goto out;
+ }
+
+ *options = dict;
+
+out:
+ if (ret && dict)
+ dict_unref (dict);
+
+ return ret;
+}
+
+int
cli_cmd_volume_defrag_parse (const char **words, int wordcount,
dict_t **options)
{
@@ -3987,16 +4037,6 @@ cli_cmd_volume_defrag_parse (const char **words, int wordcount,
if (strcmp (words[3], "start") && strcmp (words[3], "stop") &&
strcmp (words[3], "status"))
goto out;
- } else if ((strcmp (words[3], "tier") == 0) &&
- (strcmp (words[4], "start") == 0)) {
- volname = (char *) words[2];
- cmd = GF_DEFRAG_CMD_START_TIER;
- goto done;
- } else if ((strcmp (words[3], "tier") == 0) &&
- (strcmp (words[4], "status") == 0)) {
- volname = (char *) words[2];
- cmd = GF_DEFRAG_CMD_STATUS_TIER;
- goto done;
} else {
if (strcmp (words[3], "fix-layout") &&
strcmp (words[3], "start"))
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index b56457ecf63..4efb78046ab 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -4908,10 +4908,9 @@ gf_cli_attach_tier (call_frame_t *frame, xlator_t *this,
int ret = 0;
dict_t *dict = NULL;
dict_t *newdict = NULL;
- char *tierwords[] = {"volume", "rebalance", "",
- "tier", "start", NULL};
+ char *tierwords[] = {"volume", "tier", "",
+ "start", NULL};
const char **words = (const char **)tierwords;
- int wordcount = 5;
char *volname = NULL;
cli_local_t *local = NULL;
cli_local_t *oldlocal = NULL;
@@ -4939,8 +4938,8 @@ gf_cli_attach_tier (call_frame_t *frame, xlator_t *this,
}
words[2] = volname;
- ret = cli_cmd_volume_defrag_parse ((const char **)words,
- wordcount, &newdict);
+ ret = cli_cmd_volume_old_tier_parse ((const char **)words,
+ 4, &newdict);
if (ret) {
gf_log ("cli", GF_LOG_ERROR, "Failed to parse tier start "
"command");
@@ -4959,8 +4958,7 @@ notify_cli:
if (ret) {
cli_out ("Failed to run tier start. Please execute tier start "
"command explicitly");
- cli_out ("Usage : gluster volume rebalance <volname> tier "
- "start");
+ cli_out ("Usage : gluster volume tier <volname> start");
}
out:
diff --git a/cli/src/cli.h b/cli/src/cli.h
index dad3ce4e3a8..27a3f3cc136 100644
--- a/cli/src/cli.h
+++ b/cli/src/cli.h
@@ -274,6 +274,10 @@ cli_cmd_volume_tier_parse (const char **words, int wordcount,
dict_t **options);
int32_t
+cli_cmd_volume_old_tier_parse (const char **words, int wordcount,
+ dict_t **options);
+
+int32_t
cli_cmd_volume_remove_brick_parse (const char **words, int wordcount,
dict_t **options, int *question);
diff --git a/tests/basic/tier/new-tier-cmds.t b/tests/basic/tier/new-tier-cmds.t
index af5cd791b94..3c16154265d 100644
--- a/tests/basic/tier/new-tier-cmds.t
+++ b/tests/basic/tier/new-tier-cmds.t
@@ -16,7 +16,7 @@ function check_peers {
function create_dist_tier_vol () {
TEST $CLI_1 volume create $V0 $H1:$B1/${V0} $H2:$B2/${V0} $H3:$B3/${V0}
TEST $CLI_1 volume start $V0
- TEST $CLI_1 volume attach-tier $V0 $H1:$B1/${V0}_h1 $H2:$B2/${V0}_h2 $H3:$B3/${V0}_h3
+ TEST $CLI_1 volume tier $V0 attach $H1:$B1/${V0}_h1 $H2:$B2/${V0}_h2 $H3:$B3/${V0}_h3
}
function tier_daemon_status {
@@ -39,6 +39,14 @@ EXPECT_WITHIN $PROBE_TIMEOUT 2 check_peers;
#Create and start a tiered volume
create_dist_tier_vol
+########### check failure for older commands #############
+
+TEST ! $CLI_1 volume rebalance $V0 tier status
+
+# failure for older command can be removed in 3.11
+
+##########################################################
+
#Issue detach tier on the tiered volume
#Will throw error saying detach tier not started
@@ -92,6 +100,13 @@ EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" tier_detach_commit
EXPECT "Tier command failed" $CLI_1 volume tier $V0 detach status
+########### check failure for older commands #############
+
+TEST ! $CLI_1 volume rebalance $V0 tier start
+
+# failure for older command can be removed in 3.11
+
+##########################################################
cleanup;
#G_TESTDEF_TEST_STATUS_NETBSD7=KNOWN_ISSUE,BUG=000000