From 93cb168fb362c7aea3c10371574a5c5566bb0222 Mon Sep 17 00:00:00 2001 From: Kaushik BV Date: Wed, 13 Apr 2011 22:14:37 +0000 Subject: 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 Signed-off-by: Anand Avati BUG: 2536 (gsync service introspection) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2536 --- xlators/mgmt/glusterd/src/glusterd-handler.c | 30 ++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-handler.c') 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, -- cgit