summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendra@redhat.com>2014-09-18 17:12:33 +0530
committerVijay Bellur <vbellur@redhat.com>2014-09-18 10:59:30 -0700
commit82b24d64b9dc89672e6a298648f0e3959b62b1c0 (patch)
treeffd4f4d3cb091859327cbbff23c915b952e96c62 /xlators/mgmt
parentebfb51fd77782f343215251f7641a2b31674f4a1 (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. rebase of the patch http://review.gluster.org/#/c/8150/ Change-Id: Iee2582b1a823d50c79233a41cf2106f458b40691 BUG: 1143961 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-on: http://review.gluster.org/8767 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot.c4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.c37
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.h3
3 files changed, 44 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index 58e611d20dc..148acec8882 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -6259,6 +6259,7 @@ glusterd_snapshot_status_commit (dict_t *dict, char **op_errstr,
}
}
ret = 0;
+
out:
return ret;
}
@@ -7111,6 +7112,7 @@ glusterd_snapshot_postvalidate (dict_t *dict, int32_t op_ret, char **op_errstr,
"post-validation failed");
goto out;
}
+ glusterd_fetchsnap_notify (this);
break;
case GF_SNAP_OPTION_TYPE_DELETE:
if (op_ret) {
@@ -7128,6 +7130,7 @@ glusterd_snapshot_postvalidate (dict_t *dict, int32_t op_ret, char **op_errstr,
"update missed snaps list");
goto out;
}
+ glusterd_fetchsnap_notify (this);
break;
case GF_SNAP_OPTION_TYPE_RESTORE:
ret = glusterd_snapshot_update_snaps_post_validate (dict,
@@ -7146,6 +7149,7 @@ glusterd_snapshot_postvalidate (dict_t *dict, int32_t op_ret, char **op_errstr,
"perform snapshot restore post-op");
goto out;
}
+ glusterd_fetchsnap_notify (this);
break;
case GF_SNAP_OPTION_TYPE_ACTIVATE:
case GF_SNAP_OPTION_TYPE_DEACTIVATE:
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
index 559b39d8d84..5a6e55ef39e 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -227,6 +227,7 @@ set:
out:
return 0;
}
+
int
glusterd_fetchspec_notify (xlator_t *this)
{
@@ -252,6 +253,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;
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index f2f7a0a277c..9f26e7508ad 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -835,6 +835,9 @@ int
glusterd_fetchspec_notify (xlator_t *this);
int
+glusterd_fetchsnap_notify (xlator_t *this);
+
+int
glusterd_add_volume_detail_to_dict (glusterd_volinfo_t *volinfo,
dict_t *volumes, int count);