summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorKotresh H R <khiremat@redhat.com>2014-05-02 13:09:03 +0530
committerVenky Shankar <vshankar@redhat.com>2014-05-13 23:10:10 -0700
commit5c65850c99829668ac199a49a0760443db74b581 (patch)
treeffa594a1264ca8d0b2f9aab95d3ecb2f64042485 /cli
parent7d22fca1f5c9d792b148bae15e8d26a9c5d63efa (diff)
geo-rep/glusterd: Pause and Resume feature for geo-replication
This patch introduces pause and resume cli command for geo-replication. Signed-off-by: Kotresh H R <khiremat@redhat.com> Change-Id: I4f5e58e9175fe85077d56088473252391fb57de7 BUG: 1093602 Signed-off-by: Kotresh H R <khiremat@redhat.com> Reviewed-on: http://review.gluster.org/7643 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-by: Avra Sengupta <asengupt@redhat.com> Reviewed-by: Venky Shankar <vshankar@redhat.com> Tested-by: Venky Shankar <vshankar@redhat.com>
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-cmd-parser.c19
-rw-r--r--cli/src/cli-cmd-volume.c2
-rw-r--r--cli/src/cli-rpc-ops.c14
-rw-r--r--cli/src/cli-xml-output.c2
4 files changed, 34 insertions, 3 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index a41c0800ac1..287943777df 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -1802,7 +1802,9 @@ force_push_pem_parse (const char **words, int wordcount,
if ((strcmp ((char *)words[wordcount-2], "start")) &&
(strcmp ((char *)words[wordcount-2], "stop")) &&
(strcmp ((char *)words[wordcount-2], "create")) &&
- (strcmp ((char *)words[wordcount-2], "push-pem"))) {
+ (strcmp ((char *)words[wordcount-2], "push-pem")) &&
+ (strcmp ((char *)words[wordcount-2], "pause")) &&
+ (strcmp ((char *)words[wordcount-2], "resume"))) {
ret = -1;
goto out;
}
@@ -1852,7 +1854,8 @@ cli_cmd_gsync_set_parse (const char **words, int wordcount, dict_t **options)
unsigned cmdi = 0;
char *opwords[] = { "create", "status", "start", "stop",
"config", "force", "delete",
- "push-pem", "detail", NULL };
+ "push-pem", "detail", "pause",
+ "resume", NULL };
char *w = NULL;
GF_ASSERT (words);
@@ -1869,6 +1872,8 @@ cli_cmd_gsync_set_parse (const char **words, int wordcount, dict_t **options)
* volume geo-replication [$m] $s config [[!]$opt [$val]]
* volume geo-replication $m $s start|stop [force]
* volume geo-replication $m $s delete
+ * volume geo-replication $m $s pause [force]
+ * volume geo-replication $m $s resume [force]
*/
if (wordcount < 3)
@@ -1962,6 +1967,16 @@ cli_cmd_gsync_set_parse (const char **words, int wordcount, dict_t **options)
if (!masteri || !slavei)
goto out;
+ } else if (strcmp (w, "pause") == 0) {
+ type = GF_GSYNC_OPTION_TYPE_PAUSE;
+
+ if (!masteri || !slavei)
+ goto out;
+ } else if (strcmp (w, "resume") == 0) {
+ type = GF_GSYNC_OPTION_TYPE_RESUME;
+
+ if (!masteri || !slavei)
+ goto out;
} else
GF_ASSERT (!"opword mismatch");
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
index 6072fcc5193..97984721cbd 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -2397,7 +2397,7 @@ struct cli_cmd volume_cmds[] = {
#if (SYNCDAEMON_COMPILE)
{"volume "GEOREP" [<VOLNAME>] [<SLAVE-URL>] {create [push-pem] [force]"
- "|start [force]|stop [force]|config|status [detail]|delete} [options...]",
+ "|start [force]|stop [force]|pause [force]|resume [force]|config|status [detail]|delete} [options...]",
cli_cmd_volume_gsync_set_cbk,
"Geo-sync operations",
cli_cmd_check_gsync_exists_cbk},
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index f174e27e46d..bdde185cca5 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -4514,6 +4514,20 @@ gf_cli_gsync_set_cbk (struct rpc_req *req, struct iovec *iov,
master, slave);
break;
+ case GF_GSYNC_OPTION_TYPE_PAUSE:
+ case GF_GSYNC_OPTION_TYPE_RESUME:
+ if (dict_get_str (dict, "master", &master) != 0)
+ master = "???";
+ if (dict_get_str (dict, "slave", &slave) != 0)
+ slave = "???";
+
+ cli_out ("%s " GEOREP " session between %s & %s"
+ " has been successful",
+ type == GF_GSYNC_OPTION_TYPE_PAUSE ?
+ "Pausing" : "Resuming",
+ master, slave);
+ break;
+
case GF_GSYNC_OPTION_TYPE_CONFIG:
ret = gf_cli_gsync_config_command (dict);
break;
diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c
index 0eb23bff20d..5434dd4069a 100644
--- a/cli/src/cli-xml-output.c
+++ b/cli/src/cli-xml-output.c
@@ -3801,6 +3801,8 @@ cli_xml_output_vol_gsync (dict_t *dict, int op_ret, int op_errno,
switch (type) {
case GF_GSYNC_OPTION_TYPE_START:
case GF_GSYNC_OPTION_TYPE_STOP:
+ case GF_GSYNC_OPTION_TYPE_PAUSE:
+ case GF_GSYNC_OPTION_TYPE_RESUME:
if (dict_get_str (dict, "master", &master) != 0)
master = "???";
if (dict_get_str (dict, "slave", &slave) != 0)