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