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