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.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.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd.c | 67 |
1 files changed, 13 insertions, 54 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c index b33cc27dde7..95f346cbb02 100644 --- a/xlators/mgmt/glusterd/src/glusterd.c +++ b/xlators/mgmt/glusterd/src/glusterd.c @@ -1271,10 +1271,9 @@ out: return ret; } -static int -glusterd_svc_init_all () +static void +glusterd_svcs_build () { - int ret = -1; xlator_t *this = NULL; glusterd_conf_t *priv = NULL; @@ -1284,59 +1283,22 @@ glusterd_svc_init_all () priv = this->private; GF_ASSERT (priv); - /* Init SHD svc */ - ret = glusterd_shdsvc_init (&(priv->shd_svc)); - if (ret) { - gf_msg (THIS->name, GF_LOG_ERROR, 0, - GD_MSG_FAILED_INIT_SHDSVC, - "Failed to init shd service"); - goto out; - } - gf_msg_debug (THIS->name, 0, "shd service initialized"); + priv->shd_svc.build = glusterd_shdsvc_build; + priv->shd_svc.build (&(priv->shd_svc)); - /* Init NFS svc */ - ret = glusterd_nfssvc_init (&(priv->nfs_svc)); - if (ret) { - gf_msg (THIS->name, GF_LOG_ERROR, 0, - GD_MSG_FAILED_INIT_NFSSVC, - "Failed to init nfs service"); - goto out; - } - gf_msg_debug (THIS->name, 0, "nfs service initialized"); + priv->nfs_svc.build = glusterd_nfssvc_build; + priv->nfs_svc.build (&(priv->nfs_svc)); - /* Init QuotaD svc */ - ret = glusterd_quotadsvc_init (&(priv->quotad_svc)); - if (ret) { - gf_msg (THIS->name, GF_LOG_ERROR, 0, - GD_MSG_FAILED_INIT_QUOTASVC, "Failed to init quotad " - "service"); - goto out; - } - gf_msg_debug (THIS->name, 0, "quotad service initialized"); + priv->quotad_svc.build = glusterd_quotadsvc_build; + priv->quotad_svc.build (&(priv->quotad_svc)); - /* Init BitD svc */ - ret = glusterd_bitdsvc_init (&(priv->bitd_svc)); - if (ret) { - gf_msg (THIS->name, GF_LOG_ERROR, 0, - GD_MSG_BITD_INIT_FAIL, "Failed to initialized BitD " - "service"); - goto out; - } - gf_msg_debug (THIS->name, 0, "BitD service initialized"); + priv->bitd_svc.build = glusterd_bitdsvc_build; + priv->bitd_svc.build (&(priv->bitd_svc)); - ret = glusterd_scrubsvc_init (&(priv->scrub_svc)); - if (ret) { - gf_msg (THIS->name, GF_LOG_ERROR, 0, - GD_MSG_SCRUB_INIT_FAIL, "Failed to initialized scrub " - "service"); - goto out; - } - gf_msg_debug (THIS->name, 0, "scrub service initialized"); + priv->scrub_svc.build = glusterd_scrubsvc_build; + priv->scrub_svc.build (&(priv->scrub_svc)); -out: - return ret; } - /* * init - called during glusterd initialization * @@ -1738,6 +1700,7 @@ init (xlator_t *this) this->private = conf; glusterd_mgmt_v3_lock_init (); glusterd_txn_opinfo_dict_init (); + glusterd_svcs_build (); /* Make install copies few of the hook-scripts by creating hooks * directory. Hence purposefully not doing the check for the presence of @@ -1787,10 +1750,6 @@ init (xlator_t *this) goto out; } - ret = glusterd_svc_init_all (); - if (ret) - goto out; - ret = glusterd_restore (); if (ret < 0) goto out; |