diff options
author | Kaushik BV <kaushikbv@gluster.com> | 2011-04-17 10:46:06 +0000 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-04-17 21:40:59 -0700 |
commit | 4b813b3d14476a5cf6a3a54c32c2939a31fe9ba9 (patch) | |
tree | ff5d4181a8aa6d736cadf004f24ea791621e4de4 | |
parent | 666e43aca607c90d95379caa13b42a4ed976e8a7 (diff) |
mgmt/glusterd: unify the geo-replication status rpc messages.
the intelligence of determining the type of status command is now at glusterd,
rather then explicitly setting it while parsing at cli.
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
-rw-r--r-- | cli/src/cli-cmd-parser.c | 16 | ||||
-rw-r--r-- | rpc/xdr/src/cli1-xdr.h | 3 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 49 |
3 files changed, 11 insertions, 57 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index 1449d62fa1f..70a6327511e 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -1127,7 +1127,6 @@ cli_cmd_gsync_set_parse (const char **words, int wordcount, dict_t **options) char *append_str = NULL; size_t append_len = 0; int i = 0; - int32_t status_type = 0; GF_ASSERT (words); GF_ASSERT (options); @@ -1145,18 +1144,7 @@ cli_cmd_gsync_set_parse (const char **words, int wordcount, dict_t **options) 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) + if (wordcount > 5) goto out; if (wordcount < 4) @@ -1171,8 +1159,6 @@ cli_cmd_gsync_set_parse (const char **words, int wordcount, dict_t **options) if (ret < 0) goto out; - - goto set_type; } diff --git a/rpc/xdr/src/cli1-xdr.h b/rpc/xdr/src/cli1-xdr.h index 2002a3ae473..0a4b4ebd5f5 100644 --- a/rpc/xdr/src/cli1-xdr.h +++ b/rpc/xdr/src/cli1-xdr.h @@ -93,9 +93,6 @@ enum gf1_cli_gsync_set { GF_GSYNC_OPTION_TYPE_CONFIG_GET = 6, GF_GSYNC_OPTION_TYPE_CONFIG_GET_ALL = 7, GF_GSYNC_OPTION_TYPE_STATUS = 8, - GF_GSYNC_OPTION_TYPE_STATUS_ALL = 9, - GF_GSYNC_OPTION_TYPE_STATUS_MASTER = 10, - GF_GSYNC_OPTION_TYPE_STATUS_MST_SLV = 11 }; typedef enum gf1_cli_gsync_set gf1_cli_gsync_set; diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index ea63a98b898..2f5dbdc1505 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -2426,8 +2426,6 @@ out: static int glusterd_verify_gsync_status_opts (dict_t *dict, char **op_errstr) { - int status_type = 0; - char *master = NULL; char *slave = NULL; char *volname = NULL; char errmsg[PATH_MAX] = {0, }; @@ -2435,23 +2433,9 @@ glusterd_verify_gsync_status_opts (dict_t *dict, char **op_errstr) glusterd_volinfo_t *volinfo = NULL; int ret = 0; - - ret = dict_get_int32 (dict, "status-type", &status_type); - if (ret) - goto out; - - if (status_type == GF_GSYNC_OPTION_TYPE_STATUS_ALL) - goto out; - - ret = dict_get_str (dict, "master", &master); - if (ret < 0) - goto out; - - volname = volname_from_master (master); - if (volname == NULL) { - gf_log ("", GF_LOG_WARNING, "volname couldn't be found"); - *op_errstr = gf_strdup ("volname not found"); - ret = -1; + ret = dict_get_str (dict, "master", &volname); + if (ret < 0) { + ret = 0; goto out; } @@ -2466,23 +2450,13 @@ glusterd_verify_gsync_status_opts (dict_t *dict, char **op_errstr) goto out; } - - if (status_type == GF_GSYNC_OPTION_TYPE_STATUS_MASTER) - goto out; - - if (status_type != GF_GSYNC_OPTION_TYPE_STATUS_MST_SLV) - goto out; - ret = dict_get_str (dict, "slave", &slave); - if (ret < 0) + if (ret < 0) { + ret = 0; goto out; - - ret = glusterd_op_verify_gsync_running (volinfo, master, - slave, op_errstr); + } out: - if (volname) - GF_FREE (volname); gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); return ret; @@ -4665,7 +4639,6 @@ out: static int glusterd_get_gsync_status (dict_t *dict, char **op_errstr, dict_t *rsp_dict) { - int status_type = 0; char *master = NULL; char *slave = NULL; char *volname = NULL; @@ -4675,11 +4648,8 @@ glusterd_get_gsync_status (dict_t *dict, char **op_errstr, dict_t *rsp_dict) int ret = 0; - ret = dict_get_int32 (dict, "status-type", &status_type); - if (ret) - goto out; - - if (status_type == GF_GSYNC_OPTION_TYPE_STATUS_ALL) { + ret = dict_get_str (dict, "master", &volname); + if (ret < 0){ ret = glusterd_get_gsync_status_all (rsp_dict); goto out; } @@ -4708,7 +4678,8 @@ glusterd_get_gsync_status (dict_t *dict, char **op_errstr, dict_t *rsp_dict) } - if (status_type == GF_GSYNC_OPTION_TYPE_STATUS_MASTER) { + ret = dict_get_str (dict, "slave", &slave); + if (ret < 0) { ret = glusterd_get_gsync_status_mst (volinfo, rsp_dict); goto out; } |