diff options
author | Atin Mukherjee <amukherj@redhat.com> | 2015-07-01 14:47:48 +0530 |
---|---|---|
committer | Kaushal M <kaushal@redhat.com> | 2015-07-27 07:31:30 -0700 |
commit | c5a19652c80162e670d29a7bd8c910d0acdfacb9 (patch) | |
tree | 0c6295a5b62c39379ae8205728ced82541a2a53b /xlators/mgmt/glusterd/src/glusterd-utils.c | |
parent | 2ddb41874d94a925828bf3cd042b4f3f77897343 (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-utils.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 0d7284066b6..a27875fa6b6 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -500,6 +500,9 @@ glusterd_volinfo_new (glusterd_volinfo_t **volinfo) new_volinfo->xl = THIS; + new_volinfo->snapd.svc.build = glusterd_snapdsvc_build; + new_volinfo->snapd.svc.build (&(new_volinfo->snapd.svc)); + pthread_mutex_init (&new_volinfo->reflock, NULL); *volinfo = glusterd_volinfo_ref (new_volinfo); @@ -3776,35 +3779,17 @@ glusterd_import_friend_volume (dict_t *peer_data, size_t count) ret = glusterd_volinfo_find (new_volinfo->volname, &old_volinfo); if (0 == ret) { - /* snapdsvc initialization of old_volinfo is also required here - * as glusterd_delete_stale_volume () invokes snapdsvc manager - */ - ret = glusterd_snapdsvc_init (old_volinfo); - if (ret) { - gf_msg (this->name, GF_LOG_ERROR, 0, - GD_MSG_SNAPD_INIT_FAIL, "Failed to initialize" - " snapdsvc for old volume %s", - old_volinfo->volname); - goto out; - } (void) gd_check_and_update_rebalance_info (old_volinfo, new_volinfo); (void) glusterd_delete_stale_volume (old_volinfo, new_volinfo); } - ret = glusterd_snapdsvc_init (new_volinfo); - if (ret) { - gf_msg (this->name, GF_LOG_ERROR, 0, - GD_MSG_SNAPD_INIT_FAIL, "Failed to initialize " - "snapdsvc for volume %s", new_volinfo->volname); - goto out; - } - if (glusterd_is_volume_started (new_volinfo)) { (void) glusterd_start_bricks (new_volinfo); if (glusterd_is_snapd_enabled (new_volinfo)) { svc = &(new_volinfo->snapd.svc); - (void) svc->start (svc, PROC_START_NO_WAIT); + (void) svc->manager (svc, new_volinfo, + PROC_START_NO_WAIT); } } |