summaryrefslogtreecommitdiffstats
path: root/cli/src/cli-cmd-parser.c
diff options
context:
space:
mode:
authorKaushik BV <kaushikbv@gluster.com>2011-04-13 22:14:37 +0000
committerAnand Avati <avati@gluster.com>2011-04-14 01:00:55 -0700
commit93cb168fb362c7aea3c10371574a5c5566bb0222 (patch)
tree44f7fd323980d3c073498c81be34ddc6f739b0ef /cli/src/cli-cmd-parser.c
parent77cd50a12887b13db4c49be6a979a5ecb8239570 (diff)
mgmt/glusterd: Implementation of volume gsync status [master [slave]]
Changes made in the path of gsync start/stop as well, where we maintain a list of active gsync sessions, hence gsync stop could be executed at all nodes. A new dict in glusterd_volinfo_t added to maintain an active list of gsync slaves running on each master. Signed-off-by: Kaushik BV <kaushikbv@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2536 (gsync service introspection) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2536
Diffstat (limited to 'cli/src/cli-cmd-parser.c')
-rw-r--r--cli/src/cli-cmd-parser.c49
1 files changed, 48 insertions, 1 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index 1cfba3561fc..e8b0e778ae6 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -1120,13 +1120,14 @@ out:
int32_t
cli_cmd_gsync_set_parse (const char **words, int wordcount, dict_t **options)
{
- int32_t ret = 0;
+ int32_t ret = -1;
int32_t config_type = 0;
dict_t *dict = NULL;
gf1_cli_gsync_set type = GF_GSYNC_OPTION_TYPE_NONE;
char *append_str = NULL;
size_t append_len = 0;
int i = 0;
+ int32_t status_type = 0;
GF_ASSERT (words);
GF_ASSERT (options);
@@ -1138,6 +1139,43 @@ cli_cmd_gsync_set_parse (const char **words, int wordcount, dict_t **options)
if (!dict)
goto out;
+ if (wordcount < 3)
+ goto out;
+
+ if ((strcmp (words[2], "status")) == 0) {
+ type = GF_GSYNC_OPTION_TYPE_STATUS;
+
+ if (wordcount == 3)
+ status_type = GF_GSYNC_OPTION_TYPE_STATUS_ALL;
+ else if (wordcount == 4)
+ status_type = GF_GSYNC_OPTION_TYPE_STATUS_MASTER;
+ else if (wordcount == 5)
+ status_type = GF_GSYNC_OPTION_TYPE_STATUS_MST_SLV;
+ else
+ goto out;
+
+
+ ret = dict_set_int32 (dict, "status-type", status_type);
+ if (ret < 0)
+ goto out;
+
+ if (wordcount < 4)
+ goto set_type;
+ ret = dict_set_str (dict, "master", (char *)words[3]);
+ if (ret < 0)
+ goto out;
+
+ if (wordcount < 5)
+ goto set_type;
+ ret = dict_set_str (dict, "slave", (char *)words[4]);
+ if (ret < 0)
+ goto out;
+
+
+
+ goto set_type;
+ }
+
if (wordcount < 5)
goto out;
@@ -1150,12 +1188,18 @@ cli_cmd_gsync_set_parse (const char **words, int wordcount, dict_t **options)
goto out;
if ((strcmp (words[2], "start")) == 0) {
+ if (wordcount != 5)
+ goto out;
+
type = GF_GSYNC_OPTION_TYPE_START;
goto set_type;
}
if ((strcmp (words[2], "stop")) == 0) {
+ if (wordcount != 5)
+ goto out;
+
type = GF_GSYNC_OPTION_TYPE_STOP;
goto set_type;
@@ -1219,6 +1263,9 @@ cli_cmd_gsync_set_parse (const char **words, int wordcount, dict_t **options)
ret = dict_set_int32 (dict, "config_type", config_type);
if (ret < 0)
goto out;
+ } else {
+ ret = -1;
+ goto out;
}
set_type: