diff options
author | Atin Mukherjee <amukherj@redhat.com> | 2015-07-01 14:47:48 +0530 |
---|---|---|
committer | Kaushal M <kaushal@redhat.com> | 2015-07-27 00:14:01 -0700 |
commit | d49b4b1086119873664b77ea7d7f2a5dd8f671ee (patch) | |
tree | d29051a5daf4fff7e7debb6cf5ff2a737c0a993d /xlators/mgmt/glusterd/src/glusterd-quotad-svc.c | |
parent | fd296d90168002a475a9899a72a0dd1811f038ee (diff) |
glusterd: initialize the daemon services on demand
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: 1238135
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>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-quotad-svc.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-quotad-svc.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-quotad-svc.c b/xlators/mgmt/glusterd/src/glusterd-quotad-svc.c index 37824f6904f..59a76711054 100644 --- a/xlators/mgmt/glusterd/src/glusterd-quotad-svc.c +++ b/xlators/mgmt/glusterd/src/glusterd-quotad-svc.c @@ -18,16 +18,21 @@ char *quotad_svc_name = "quotad"; +void +glusterd_quotadsvc_build (glusterd_svc_t *svc) +{ + svc->manager = glusterd_quotadsvc_manager; + svc->start = glusterd_quotadsvc_start; + svc->stop = glusterd_svc_stop; +} + int glusterd_quotadsvc_init (glusterd_svc_t *svc) { int ret = -1; char volfile[PATH_MAX] = {0,}; glusterd_conf_t *conf = THIS->private; - ret = glusterd_svc_init (svc, quotad_svc_name, - glusterd_quotadsvc_manager, - glusterd_quotadsvc_start, - glusterd_svc_stop); + ret = glusterd_svc_init (svc, quotad_svc_name); if (ret) goto out; @@ -60,6 +65,20 @@ glusterd_quotadsvc_manager (glusterd_svc_t *svc, void *data, int flags) int ret = 0; glusterd_volinfo_t *volinfo = NULL; + if (!svc->inited) { + ret = glusterd_quotadsvc_init (svc); + if (ret) { + gf_msg (THIS->name, GF_LOG_ERROR, 0, + GD_MSG_FAILED_INIT_QUOTASVC, "Failed to init " + "quotad service"); + goto out; + } else { + svc->inited = _gf_true; + gf_msg_debug (THIS->name, 0, "quotad service " + "initialized"); + } + } + volinfo = data; /* If all the volumes are stopped or all shd compatible volumes |