From 0fe5ab5b9215b8f0ecfb8bc4ba15a5370850654a Mon Sep 17 00:00:00 2001 From: Varun Shastry Date: Tue, 6 May 2014 12:39:20 +0000 Subject: glusterd: Changes to provide interface for USS The changes which consists of the translators for the USS (User Servicable Snapshots) is submitted as a separate patch. Current patch provides the CLI access to the feature. Change-Id: I6b98a42fcfa82f0870d8048fe0bb53141565e9c6 BUG: 1094815 Signed-off-by: Varun Shastry Reviewed-on: http://review.gluster.org/7705 Tested-by: Gluster Build System Reviewed-by: Atin Mukherjee Reviewed-by: Krishnan Parthasarathi Tested-by: Krishnan Parthasarathi --- xlators/mgmt/glusterd/src/glusterd-handler.c | 59 ++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) (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 e203e5af01f..733bea236ed 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -4137,6 +4137,65 @@ glusterd_brick_rpc_notify (struct rpc_clnt *rpc, void *mydata, __glusterd_brick_rpc_notify); } +int +__glusterd_snapd_rpc_notify (struct rpc_clnt *rpc, void *mydata, + rpc_clnt_event_t event, void *data) +{ + xlator_t *this = NULL; + glusterd_conf_t *conf = NULL; + glusterd_volinfo_t *volinfo = NULL; + int ret = 0; + + this = THIS; + GF_ASSERT (this); + conf = this->private; + GF_ASSERT (conf); + + volinfo = mydata; + if (!volinfo) + return 0; + + switch (event) { + case RPC_CLNT_CONNECT: + gf_log (this->name, GF_LOG_DEBUG, "got RPC_CLNT_CONNECT"); + + (void) glusterd_snapd_set_online_status (volinfo, _gf_true); + + break; + + case RPC_CLNT_DISCONNECT: + if (glusterd_is_snapd_online (volinfo)) { + gf_msg (this->name, GF_LOG_INFO, 0, + GD_MSG_NODE_DISCONNECTED, + "snapd for volume %s has disconnected from " + "glusterd.", volinfo->volname); + + (void) glusterd_snapd_set_online_status + (volinfo, _gf_false); + } + break; + + case RPC_CLNT_DESTROY: + glusterd_volinfo_unref (volinfo); + break; + + default: + gf_log (this->name, GF_LOG_TRACE, + "got some other RPC event %d", event); + break; + } + + return ret; +} + +int +glusterd_snapd_rpc_notify (struct rpc_clnt *rpc, void *mydata, + rpc_clnt_event_t event, void *data) +{ + return glusterd_big_locked_notify (rpc, mydata, event, data, + __glusterd_snapd_rpc_notify); +} + int __glusterd_nodesvc_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event, void *data) -- cgit