diff options
author | Raghavendra Bhat <raghavendra@redhat.com> | 2014-06-17 00:28:01 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2014-09-08 07:14:19 -0700 |
commit | 822cf315a5d0f0d2bc90e9f2d8faa6e5e5701ed4 (patch) | |
tree | c386b9c054c86b033cf1945dc7ce3c7a3af687e9 /xlators/mgmt/glusterd/src/glusterd.c | |
parent | 5c869aea79c0f304150eac014c7177e74ce0852e (diff) |
snapview-server: register a callback with glusterd to get notifications
* As of now snapview-server is polling (sending rpc requests to glusterd) to
get the latest list of snapshots at some regular time intervals
(non configurable). Instead of that register a callback with glusterd so that
glusterd sends notifications to snapd whenever a snapshot is created/deleted
and snapview-server can configure itself.
Change-Id: I17a274fd2ab487d030678f0077feb2b0f35e5896
BUG: 1119628
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.org/8150
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c index ab7ab3a2171..b9a43cd32ce 100644 --- a/xlators/mgmt/glusterd/src/glusterd.c +++ b/xlators/mgmt/glusterd/src/glusterd.c @@ -216,6 +216,7 @@ glusterd_options_init (xlator_t *this) out: return 0; } + int glusterd_fetchspec_notify (xlator_t *this) { @@ -241,6 +242,42 @@ glusterd_fetchspec_notify (xlator_t *this) } int +glusterd_fetchsnap_notify (xlator_t *this) +{ + int ret = -1; + glusterd_conf_t *priv = NULL; + rpc_transport_t *trans = NULL; + + priv = this->private; + + /* + * TODO: As of now, the identification of the rpc clients in the + * handshake protocol is not there. So among so many glusterfs processes + * registered with glusterd, it is hard to identify one particular + * process (in this particular case, the snap daemon). So the callback + * notification is sent to all the transports from the transport list. + * Only those processes which have a rpc client registered for this + * callback will respond to the notification. Once the identification + * of the rpc clients becomes possible, the below section can be changed + * to send callback notification to only those rpc clients, which have + * registered. + */ + pthread_mutex_lock (&priv->xprt_lock); + { + list_for_each_entry (trans, &priv->xprt_list, list) { + rpcsvc_callback_submit (priv->rpc, trans, + &glusterd_cbk_prog, + GF_CBK_GET_SNAPS, NULL, 0); + } + } + pthread_mutex_unlock (&priv->xprt_lock); + + ret = 0; + + return ret; +} + +int glusterd_priv (xlator_t *this) { return 0; |