summaryrefslogtreecommitdiffstats
path: root/cli/src
diff options
context:
space:
mode:
authorVenky Shankar <venky@gluster.com>2011-09-28 16:38:00 +0530
committerVijay Bellur <vijay@gluster.com>2011-10-20 23:26:23 -0700
commitbdf20a205a4d67d5f6d3ac6010a34291c2822a80 (patch)
tree412c56b2d2f765011a7b158f4b31b75a7bffce2b /cli/src
parent84ebee8c20ce667a5ec5fddc0aa47f8b5bef39f8 (diff)
cli: add geo-replication log-rotate command
Rotating geo-replication master/monitor log files from cli. On invocation, the log file for a given master-slave session is backed up with the current timestamp suffixed to the file name and signal is sent to gsyncd to start logging to a new log file. Sample commands: * Rotate log file for this <master>:<slave> session: gluster volume geo-replication <master> <slave> log-rotate * Rotate log files for all session for master volume <master> gluster volume geo-replication <master> log-rotate * Rotate log files for all sessions: gluster volume geo-replication log-rotate Change-Id: I75f641b4e082a04d5373c18583ca4a1d9651d27a BUG: 3519 Reviewed-on: http://review.gluster.com/529 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Csaba Henk <csaba@gluster.com>
Diffstat (limited to 'cli/src')
-rw-r--r--cli/src/cli-cmd-parser.c8
-rw-r--r--cli/src/cli-cmd-volume.c2
2 files changed, 8 insertions, 2 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index d3cb1240fe7..e09db1ce67f 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -1323,7 +1323,7 @@ cli_cmd_gsync_set_parse (const char **words, int wordcount, dict_t **options)
unsigned glob = 0;
unsigned cmdi = 0;
char *opwords[] = { "status", "start", "stop", "config",
- NULL };
+ "log-rotate", NULL };
char *w = NULL;
GF_ASSERT (words);
@@ -1338,6 +1338,7 @@ cli_cmd_gsync_set_parse (const char **words, int wordcount, dict_t **options)
* volume geo-replication [$m [$s]] status
* volume geo-replication [$m] $s config [[!]$opt [$val]]
* volume geo-replication $m $s start|stop
+ * volume geo-replication $m [$s] log-rotate
*/
if (wordcount < 3)
@@ -1414,6 +1415,11 @@ cli_cmd_gsync_set_parse (const char **words, int wordcount, dict_t **options)
if (!masteri || !slavei)
goto out;
+ } else if (strcmp(w, "log-rotate") == 0) {
+ type = GF_GSYNC_OPTION_TYPE_ROTATE;
+
+ if (slavei && !masteri)
+ goto out;
} else
GF_ASSERT (!"opword mismatch");
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
index 9b85bf819c1..425840f7fae 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -1650,7 +1650,7 @@ struct cli_cmd volume_cmds[] = {
"reset all the reconfigured options"},
#if (SYNCDAEMON_COMPILE)
- {"volume "GEOREP" [<VOLNAME>] [<SLAVE-URL>] {start|stop|config|status} [options...]",
+ {"volume "GEOREP" [<VOLNAME>] [<SLAVE-URL>] {start|stop|config|status|log-rotate} [options...]",
cli_cmd_volume_gsync_set_cbk,
"Geo-sync operations",
cli_cmd_check_gsync_exists_cbk},