summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra Talur <rtalur@redhat.com>2013-02-28 14:41:52 +0530
committerAnand Avati <avati@redhat.com>2014-03-05 21:30:51 -0800
commita193f2262b93a06bf1a299f423d4ebaaa171a539 (patch)
tree898721b76a43c81f04b4acc1d427630796564ea8
parent1fbffa0aa45560889e29a74c4c6ff16d526de700 (diff)
cli: Changed log rotate command format to common format.
Problem: The syntax of log rotate was volume log rotate <volname> [<brick>] All other commands are of the form: volume <verb|noun> <volname> [<actions>|options] Solution: Changed log rotate command usage to common format. Old syntax is also supported, it will be deprecated in next release. Change-Id: Ia6f6665185a1549c6f79ca763599b446f29e2c78 BUG: 844187 Signed-off-by: Raghavendra Talur <rtalur@redhat.com> Reviewed-on: http://review.gluster.org/4594 Reviewed-by: Kaushal M <kaushal@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
-rw-r--r--cli/src/cli-cmd-parser.c5
-rw-r--r--cli/src/cli-cmd-volume.c14
2 files changed, 17 insertions, 2 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index 7a2ff026d88..1513e0c5ef5 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -1605,7 +1605,10 @@ cli_cmd_log_rotate_parse (const char **words, int wordcount, dict_t **options)
if (!dict)
goto out;
- volname = (char *)words[3];
+ if (strcmp ("rotate", words[3]) == 0)
+ volname = (char *)words[2];
+ else if (strcmp ("rotate", words[2]) == 0)
+ volname = (char *)words[3];
GF_ASSERT (volname);
ret = dict_set_str (dict, "volname", volname);
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
index fc3b7229a21..8d80aaeb3cc 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -1691,6 +1691,13 @@ cli_cmd_log_rotate_cbk (struct cli_state *state, struct cli_cmd_word *word,
goto out;
}
+ if (!((strcmp ("rotate", words[2]) == 0) ||
+ (strcmp ("rotate", words[3]) == 0))) {
+ cli_usage_out (word->pattern);
+ parse_error = 1;
+ goto out;
+ }
+
proc = &cli_rpc_prog->proctable[GLUSTER_CLI_LOG_ROTATE];
frame = create_frame (THIS, THIS->ctx->pool);
@@ -2316,10 +2323,15 @@ struct cli_cmd volume_cmds[] = {
cli_cmd_volume_help_cbk,
"display help for the volume command"},
- { "volume log rotate <VOLNAME> [BRICK]",
+ { "volume log <VOLNAME> rotate [BRICK]",
cli_cmd_log_rotate_cbk,
"rotate the log file for corresponding volume/brick"},
+ { "volume log rotate <VOLNAME> [BRICK]",
+ cli_cmd_log_rotate_cbk,
+ "rotate the log file for corresponding volume/brick"
+ " NOTE: This is an old syntax, will be deprecated from next release."},
+
{ "volume sync <HOSTNAME> [all|<VOLNAME>]",
cli_cmd_sync_volume_cbk,
"sync the volume information from a peer"},