From 0dd8c38d17e51c4b8bd1471854315e27c25cc615 Mon Sep 17 00:00:00 2001 From: Csaba Henk Date: Tue, 19 Apr 2011 07:19:17 +0000 Subject: geo-replication: revamp CONFIG command Drop the config_type RPC req field, use just a "subop" key in the param dict. Signed-off-by: Csaba Henk Signed-off-by: Anand Avati BUG: 2785 (gsyncd logs on slave side go to /dev/null) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2785 --- cli/src/cli-cmd-parser.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'cli/src/cli-cmd-parser.c') diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index 70a632751..4a395c849 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -1121,11 +1121,11 @@ int32_t cli_cmd_gsync_set_parse (const char **words, int wordcount, dict_t **options) { 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; + char *subop = NULL; int i = 0; GF_ASSERT (words); @@ -1192,34 +1192,32 @@ cli_cmd_gsync_set_parse (const char **words, int wordcount, dict_t **options) } if ((strcmp (words[2], "config")) == 0) { - type = GF_GSYNC_OPTION_TYPE_CONFIGURE; + type = GF_GSYNC_OPTION_TYPE_CONFIG; switch (wordcount) { case 5: - config_type = GF_GSYNC_OPTION_TYPE_CONFIG_GET_ALL; + subop = gf_strdup ("get-all"); break; case 6: if (words[5][0] == '!') { - config_type = GF_GSYNC_OPTION_TYPE_CONFIG_DEL; - i = 1; - } else { - config_type = GF_GSYNC_OPTION_TYPE_CONFIG_GET; - i = 0; - } + (words[5])++; + subop = gf_strdup ("del"); + } else + subop = gf_strdup ("get"); - ret = dict_set_str (dict, "op_name", ((char *)words[5]) + i); + ret = dict_set_str (dict, "op_name", ((char *)words[5])); if (ret < 0) goto out; break; default: - config_type = GF_GSYNC_OPTION_TYPE_CONFIG_SET; - if (wordcount < 7) { ret = -1; goto out; } + subop = gf_strdup ("set"); + ret = dict_set_str (dict, "op_name", (char *)words[5]); if (ret < 0) goto out; @@ -1246,9 +1244,10 @@ cli_cmd_gsync_set_parse (const char **words, int wordcount, dict_t **options) goto out; } - ret = dict_set_int32 (dict, "config_type", config_type); - if (ret < 0) + if (!subop || dict_set_dynstr (dict, "subop", subop) != 0) { + ret = -1; goto out; + } } else { ret = -1; goto out; -- cgit