diff options
author | Kaushik BV <kaushikbv@gluster.com> | 2011-04-13 22:14:37 +0000 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-04-14 01:00:55 -0700 |
commit | 93cb168fb362c7aea3c10371574a5c5566bb0222 (patch) | |
tree | 44f7fd323980d3c073498c81be34ddc6f739b0ef /xlators/mgmt/glusterd/src/glusterd-handler.c | |
parent | 77cd50a12887b13db4c49be6a979a5ecb8239570 (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 'xlators/mgmt/glusterd/src/glusterd-handler.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handler.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index 3ebe5f51f42..247c655b031 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -1669,8 +1669,14 @@ glusterd_handle_gsync_set (rpcsvc_request_t *req) char *slave = NULL; char operation[256] = {0,}; int type = 0; + glusterd_conf_t *priv = NULL; + char *host_uuid = NULL; GF_ASSERT (req); + GF_ASSERT (THIS); + GF_ASSERT (THIS->private); + + priv = THIS->private; ret = glusterd_op_set_cli_op (cli_op); if (ret) { @@ -1701,20 +1707,32 @@ glusterd_handle_gsync_set (rpcsvc_request_t *req) } else { dict->extra_stdfree = cli_req.dict.dict_val; } + + host_uuid = gf_strdup (uuid_utoa(priv->uuid)); + if (host_uuid == NULL) { + gf_log ("glusterd", GF_LOG_ERROR, "failed to get" + "the uuid of the host machine"); + ret = -1; + goto out; + } + ret = dict_set_dynstr (dict, "host-uuid", host_uuid); + if (ret) + goto out; + } ret = dict_get_str (dict, "master", &master); if (ret < 0) { - gf_log ("", GF_LOG_WARNING, "master not found, while handling" + gf_log ("", GF_LOG_INFO, "master not found, while handling" "gsync options"); - goto out; + master = "(No Master)"; } ret = dict_get_str (dict, "slave", &slave); if (ret < 0) { - gf_log ("", GF_LOG_WARNING, "slave not not found, while" + gf_log ("", GF_LOG_INFO, "slave not not found, while" "handling gsync options"); - goto out; + slave = "(No Slave)"; } ret = dict_get_int32 (dict, "type", &type); @@ -1737,6 +1755,10 @@ glusterd_handle_gsync_set (rpcsvc_request_t *req) case GF_GSYNC_OPTION_TYPE_CONFIGURE: strncpy (operation, "configure", sizeof (operation)); break; + + case GF_GSYNC_OPTION_TYPE_STATUS: + strncpy (operation, "status", sizeof (operation)); + break; } gf_cmd_log ("volume gsync", " %s command on %s,%s", operation, master, |