diff options
author | Pranith Kumar K <pranithk@gluster.com> | 2011-09-29 19:37:18 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2011-09-29 09:55:15 -0700 |
commit | b43596fb4cdb84ae8b5665537914fe72517b8722 (patch) | |
tree | 36d378691d0e09db35d2cf53d1adba18a12181e0 /xlators/mgmt/glusterd/src/glusterd-utils.c | |
parent | ce8a569e9f18cfff2f2befe259c2022d9b37538f (diff) |
mgmt/glusterd: skip shd graph generation for non-replicate vols
Change-Id: I1bb83342bc0fa883ede527527ec8fd6ee470f781
BUG: 3666
Reviewed-on: http://review.gluster.com/535
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 62 |
1 files changed, 57 insertions, 5 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index d2305df1ee3..f4b888891c0 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -2798,20 +2798,72 @@ glusterd_nodesvcs_stop (glusterd_volinfo_t *volinfo) glusterd_shd_stop); } +gf_boolean_t +glusterd_are_all_volumes_stopped () +{ + glusterd_conf_t *priv = NULL; + xlator_t *this = NULL; + glusterd_volinfo_t *voliter = NULL; + + this = THIS; + GF_ASSERT (this); + priv = this->private; + GF_ASSERT (priv); + + list_for_each_entry (voliter, &priv->volumes, vol_list) { + if (voliter->status == GLUSTERD_STATUS_STARTED) + return _gf_false; + } + + return _gf_true; + +} + +gf_boolean_t +glusterd_all_replicate_volumes_stopped () +{ + glusterd_conf_t *priv = NULL; + xlator_t *this = NULL; + glusterd_volinfo_t *voliter = NULL; + + this = THIS; + GF_ASSERT (this); + priv = this->private; + GF_ASSERT (priv); + + list_for_each_entry (voliter, &priv->volumes, vol_list) { + if (!glusterd_is_volume_replicate (voliter)) + continue; + if (voliter->status == GLUSTERD_STATUS_STARTED) + return _gf_false; + } + + return _gf_true; +} + int glusterd_nodesvcs_handle_graph_change (glusterd_volinfo_t *volinfo) { - return glusterd_nodesvcs_batch_op (volinfo, - glusterd_check_generate_start_nfs, - glusterd_check_generate_start_shd); + int (*shd_op) () = NULL; + int (*nfs_op) () = NULL; + + shd_op = glusterd_check_generate_start_shd; + nfs_op = glusterd_check_generate_start_nfs; + if (glusterd_are_all_volumes_stopped ()) { + shd_op = glusterd_shd_stop; + nfs_op = glusterd_nfs_server_stop; + } else if (glusterd_all_replicate_volumes_stopped()) { + shd_op = glusterd_shd_stop; + } + return glusterd_nodesvcs_batch_op (volinfo, nfs_op, shd_op); } int glusterd_nodesvcs_handle_reconfigure (glusterd_volinfo_t *volinfo) { return glusterd_nodesvcs_batch_op (volinfo, - glusterd_check_generate_start_nfs, - glusterd_reconfigure_shd); + glusterd_check_generate_start_nfs, + glusterd_reconfigure_shd); } int |