summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c21
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c62
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c5
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-ops.c7
4 files changed, 62 insertions, 33 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index bb8cccfbfeb..6e2ee7e5b68 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -135,27 +135,6 @@ glusterd_is_volume_started (glusterd_volinfo_t *volinfo)
return (volinfo->status == GLUSTERD_STATUS_STARTED);
}
-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;
-
-}
-
static int
glusterd_op_sm_inject_all_acc ()
{
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
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 13c1bffa090..2ade1c57431 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -2461,6 +2461,9 @@ build_shd_graph (volgen_graph_t *graph, dict_t *mod_dict)
if (voliter->status != GLUSTERD_STATUS_STARTED)
continue;
+ if (!glusterd_is_volume_replicate (voliter))
+ continue;
+
replica_count = voliter->replica_count;
valid_config = _gf_true;
@@ -2965,7 +2968,7 @@ glusterd_create_shd_volfile ()
goto out;
glusterd_get_nodesvc_volfile ("glustershd", conf->workdir,
- filepath, sizeof (filepath));
+ filepath, sizeof (filepath));
ret = glusterd_create_global_volfile (build_shd_graph, filepath,
mod_dict);
out:
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
index 6888fd9d5ec..b1686b32162 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -1299,12 +1299,7 @@ glusterd_op_stop_volume (dict_t *dict)
if (ret)
goto out;
- if (glusterd_are_all_volumes_stopped ()) {
- ret = glusterd_nodesvcs_stop (volinfo);
- } else {
- ret = glusterd_nodesvcs_handle_graph_change (volinfo);
- }
-
+ ret = glusterd_nodesvcs_handle_graph_change (volinfo);
out:
return ret;
}