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