summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c
diff options
context:
space:
mode:
authorAtin Mukherjee <amukherj@redhat.com>2016-08-12 10:22:17 +0530
committerAtin Mukherjee <amukherj@redhat.com>2016-08-23 07:48:01 -0700
commit063a234e6265265606425449da1d6c2f97fbf457 (patch)
tree66f0cc09c46c37da8d077d3315f69687339b87c7 /xlators/mgmt/glusterd/src/glusterd-snapd-svc.c
parent1c4c75c358df745cc73b73bf2ee08e5c5d0b598f (diff)
glusterd: add async events (part 2)
Change-Id: I7a5687143713c283f0051aac2383f780e3e43646 BUG: 1360809 Signed-off-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-on: http://review.gluster.org/15153 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Samikshan Bairagya <samikshan@gmail.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-snapd-svc.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapd-svc.c42
1 files changed, 27 insertions, 15 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c b/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c
index 36e4a196845..acb24fff187 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c
@@ -204,6 +204,10 @@ glusterd_snapdsvc_manager (glusterd_svc_t *svc, void *data, int flags)
}
out:
+ if (ret) {
+ gf_event (EVENT_SVC_MANAGER_FAILED, "volume=%s;svc_name=%s",
+ volinfo->volname, svc->name);
+ }
gf_msg_debug (THIS->name, 0, "Returning %d", ret);
return ret;
@@ -347,6 +351,9 @@ glusterd_snapdsvc_restart ()
GD_MSG_SNAPD_START_FAIL,
"Couldn't resolve snapd for "
"vol: %s on restart", volinfo->volname);
+ gf_event (EVENT_SVC_MANAGER_FAILED,
+ "volume=%s;svc_name=%s",
+ volinfo->volname, svc->name);
goto out;
}
}
@@ -373,11 +380,28 @@ glusterd_snapdsvc_rpc_notify (glusterd_conn_t *conn, rpc_clnt_event_t event)
GD_MSG_SVC_GET_FAIL, "Failed to get the service");
return -1;
}
+ snapd = cds_list_entry (svc, glusterd_snapdsvc_t, svc);
+ if (!snapd) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SNAPD_OBJ_GET_FAIL, "Failed to get the "
+ "snapd object");
+ return -1;
+ }
+
+ volinfo = cds_list_entry (snapd, glusterd_volinfo_t, snapd);
+ if (!volinfo) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLINFO_GET_FAIL, "Failed to get the "
+ "volinfo object");
+ return -1;
+ }
switch (event) {
case RPC_CLNT_CONNECT:
gf_msg_debug (this->name, 0, "%s has connected with "
"glusterd.", svc->name);
+ gf_event (EVENT_SVC_CONNECTED, "volume=%s;svc_name=%s",
+ volinfo->volname, svc->name);
svc->online = _gf_true;
break;
@@ -386,26 +410,14 @@ glusterd_snapdsvc_rpc_notify (glusterd_conn_t *conn, rpc_clnt_event_t event)
gf_msg (this->name, GF_LOG_INFO, 0,
GD_MSG_NODE_DISCONNECTED, "%s has disconnected "
"from glusterd.", svc->name);
+ gf_event (EVENT_SVC_DISCONNECTED,
+ "volume=%s;svc_name=%s", volinfo->volname,
+ svc->name);
svc->online = _gf_false;
}
break;
case RPC_CLNT_DESTROY:
- snapd = cds_list_entry (svc, glusterd_snapdsvc_t, svc);
- if (!snapd) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- GD_MSG_SNAPD_OBJ_GET_FAIL, "Failed to get the "
- "snapd object");
- return -1;
- }
-
- volinfo = cds_list_entry (snapd, glusterd_volinfo_t, snapd);
- if (!volinfo) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- GD_MSG_VOLINFO_GET_FAIL, "Failed to get the "
- "volinfo object");
- return -1;
- }
glusterd_volinfo_unref (volinfo);
default: