190130
From 5b3fcc8db86b4dc7af1eb63315ca2ff41c60fdea Mon Sep 17 00:00:00 2001
190130
From: kshithijiyer <kshithij.ki@gmail.com>
190130
Date: Sat, 30 Nov 2019 15:25:11 +0530
190130
Subject: [PATCH 395/449] [Cli] Removing old log rotate command.
190130
190130
The old command for log rotate is still present removing
190130
it completely. Also adding testcase to test the
190130
log rotate command with both the old as well as the new command
190130
and fixing testcase which use the old syntax to use the new
190130
one.
190130
190130
Code to be removed:
190130
1. In cli-cmd-volume.c from struct cli_cmd volume_cmds[]:
190130
{"volume log rotate <VOLNAME> [BRICK]", cli_cmd_log_rotate_cbk,
190130
 "rotate the log file for corresponding volume/brick"
190130
 " NOTE: This is an old syntax, will be deprecated from next release."},
190130
190130
2. In cli-cmd-volume.c from cli_cmd_log_rotate_cbk():
190130
 ||(strcmp("rotate", words[2]) == 0)))
190130
190130
3. In cli-cmd-parser.c from cli_cmd_log_rotate_parse()
190130
if (strcmp("rotate", words[2]) == 0)
190130
   volname = (char *)words[3];
190130
else
190130
190130
> upstream patch link: https://review.gluster.org/#/c/glusterfs/+/23392/
190130
> fixes: bz#1750387
190130
> Change-Id: I56e4d295044e8d5fd1fc0d848bc87e135e9e32b4
190130
> Signed-off-by: kshithijiyer <kshithij.ki@gmail.com>
190130
190130
BUG: 1784415
190130
Change-Id: I56e4d295044e8d5fd1fc0d848bc87e135e9e32b4
190130
Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
190130
Reviewed-on: https://code.engineering.redhat.com/gerrit/202334
190130
Tested-by: RHGS Build Bot <nigelb@redhat.com>
190130
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
190130
---
190130
 cli/src/cli-cmd-parser.c                        | 2 --
190130
 cli/src/cli-cmd-volume.c                        | 7 +------
190130
 tests/bugs/glusterd/optimized-basic-testcases.t | 3 ++-
190130
 tests/bugs/glusterfs-server/bug-852147.t        | 2 +-
190130
 4 files changed, 4 insertions(+), 10 deletions(-)
190130
190130
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
190130
index 4456a7b..ac0a263 100644
190130
--- a/cli/src/cli-cmd-parser.c
190130
+++ b/cli/src/cli-cmd-parser.c
190130
@@ -2592,8 +2592,6 @@ cli_cmd_log_rotate_parse(const char **words, int wordcount, dict_t **options)
190130
 
190130
     if (strcmp("rotate", words[3]) == 0)
190130
         volname = (char *)words[2];
190130
-    else if (strcmp("rotate", words[2]) == 0)
190130
-        volname = (char *)words[3];
190130
     GF_ASSERT(volname);
190130
 
190130
     ret = dict_set_str(dict, "volname", volname);
190130
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
190130
index 754d333..f33fc99 100644
190130
--- a/cli/src/cli-cmd-volume.c
190130
+++ b/cli/src/cli-cmd-volume.c
190130
@@ -2349,8 +2349,7 @@ cli_cmd_log_rotate_cbk(struct cli_state *state, struct cli_cmd_word *word,
190130
         goto out;
190130
     }
190130
 
190130
-    if (!((strcmp("rotate", words[2]) == 0) ||
190130
-          (strcmp("rotate", words[3]) == 0))) {
190130
+    if (!(strcmp("rotate", words[3]) == 0)) {
190130
         cli_usage_out(word->pattern);
190130
         parse_error = 1;
190130
         goto out;
190130
@@ -3401,10 +3400,6 @@ struct cli_cmd volume_cmds[] = {
190130
     {"volume log <VOLNAME> rotate [BRICK]", cli_cmd_log_rotate_cbk,
190130
      "rotate the log file for corresponding volume/brick"},
190130
 
190130
-    {"volume log rotate <VOLNAME> [BRICK]", cli_cmd_log_rotate_cbk,
190130
-     "rotate the log file for corresponding volume/brick"
190130
-     " NOTE: This is an old syntax, will be deprecated from next release."},
190130
-
190130
     {"volume sync <HOSTNAME> [all|<VOLNAME>]", cli_cmd_sync_volume_cbk,
190130
      "sync the volume information from a peer"},
190130
 
190130
diff --git a/tests/bugs/glusterd/optimized-basic-testcases.t b/tests/bugs/glusterd/optimized-basic-testcases.t
190130
index c7e8c32..862f329 100644
190130
--- a/tests/bugs/glusterd/optimized-basic-testcases.t
190130
+++ b/tests/bugs/glusterd/optimized-basic-testcases.t
190130
@@ -129,7 +129,8 @@ TEST ! $CLI volume set all $V0 cluster.op-version $OP_VERS_NEW
190130
 
190130
 #bug-1022055 - validate log rotate command
190130
 
190130
-TEST $CLI volume log rotate $V0;
190130
+TEST ! $CLI volume log rotate $V0;
190130
+TEST $CLI volume log $V0 rotate;
190130
 
190130
 #bug-1092841 - validating barrier enable/disable
190130
 
190130
diff --git a/tests/bugs/glusterfs-server/bug-852147.t b/tests/bugs/glusterfs-server/bug-852147.t
190130
index c644cfa..75db2a2 100755
190130
--- a/tests/bugs/glusterfs-server/bug-852147.t
190130
+++ b/tests/bugs/glusterfs-server/bug-852147.t
190130
@@ -66,7 +66,7 @@ ren_file=$log_file".*"
190130
 rm -rf $ren_file
190130
 
190130
 #Initiating log rotate
190130
-TEST $CLI volume log rotate $V0
190130
+TEST $CLI volume log $V0 rotate
190130
 
190130
 #Capturing new log file's size
190130
 new_file_size=`file-size $log_file`
190130
-- 
190130
1.8.3.1
190130