summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
diff options
context:
space:
mode:
authorAtin Mukherjee <amukherj@redhat.com>2015-07-01 14:47:48 +0530
committerKaushal M <kaushal@redhat.com>2015-07-27 07:31:30 -0700
commitc5a19652c80162e670d29a7bd8c910d0acdfacb9 (patch)
tree0c6295a5b62c39379ae8205728ced82541a2a53b /xlators/mgmt/glusterd/src/glusterd-shd-svc.c
parent2ddb41874d94a925828bf3cd042b4f3f77897343 (diff)
glusterd: initialize the daemon services on demand
Backport of http://review.gluster.org/#/c/11488/ As of now all the daemon services are initialized at glusterD init path. Since socket file path of per node daemon demands the uuid of the node, MY_UUID macro is invoked as part of the initialization. The above flow breaks the usecases where a gluster image is built following a template could be Dockerfile, Vagrantfile or any kind of virtualization environment. This means bringing instances of this image would have same UUIDs for the node resulting in peer probe failure. Solution is to lazily initialize the services on demand. Change-Id: If7caa533026c83e98c7c7678bded67085d0bbc1e BUG: 1247012 Signed-off-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-on: http://review.gluster.org/11488 Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Gaurav Kumar Garg <ggarg@redhat.com> Reviewed-by: Kaushal M <kaushal@redhat.com> Reviewed-on: http://review.gluster.org/11766
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-shd-svc.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-shd-svc.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-shd-svc.c b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
index 49454cc5875..f9f41898b39 100644
--- a/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
+++ b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
@@ -18,13 +18,18 @@
char *shd_svc_name = "glustershd";
+void
+glusterd_shdsvc_build (glusterd_svc_t *svc)
+{
+ svc->manager = glusterd_shdsvc_manager;
+ svc->start = glusterd_shdsvc_start;
+ svc->stop = glusterd_svc_stop;
+}
+
int
glusterd_shdsvc_init (glusterd_svc_t *svc)
{
- return glusterd_svc_init (svc, shd_svc_name,
- glusterd_shdsvc_manager,
- glusterd_shdsvc_start,
- glusterd_svc_stop);
+ return glusterd_svc_init (svc, shd_svc_name);
}
static int
@@ -80,6 +85,19 @@ glusterd_shdsvc_manager (glusterd_svc_t *svc, void *data, int flags)
int ret = 0;
glusterd_volinfo_t *volinfo = NULL;
+ if (!svc->inited) {
+ ret = glusterd_shdsvc_init (svc);
+ if (ret) {
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_FAILED_INIT_SHDSVC, "Failed to init shd "
+ "service");
+ goto out;
+ } else {
+ svc->inited = _gf_true;
+ gf_msg_debug (THIS->name, 0, "shd service initialized");
+ }
+ }
+
volinfo = data;
/* If all the volumes are stopped or all shd compatible volumes