summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd
diff options
context:
space:
mode:
authorMohammed Rafi KC <rkavunga@redhat.com>2015-05-26 10:59:45 +0530
committerDan Lambright <dlambrig@redhat.com>2015-06-19 09:58:49 -0700
commit7aaa414c67be460aca3c1c5eed047e3db17bd435 (patch)
tree944b0cfbaec2e5b28230d36d33c481c2030bb9c3 /xlators/mgmt/glusterd
parent2fea88d70b2fb9d479f539509ae930ac6f05eb5c (diff)
glusterd/tier: configure tier daemon during volume restart
rebalance daemon will be running on every tier volume for promoting/demoting the files. When volume/glusterd is restarted, then we need to configure the daemon. Change-Id: Ib565240a70edea2ec8bc1601c52b40c0783491d3 BUG: 1225330 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> Signed-off-by: Joseph Fernandes <josferna@redhat.com> Reviewed-on: http://review.gluster.org/10933 Reviewed-by: Dan Lambright <dlambrig@redhat.com> Tested-by: Dan Lambright <dlambrig@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rebalance.c13
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c45
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.h7
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-ops.c4
4 files changed, 56 insertions, 13 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
index 0ec1d69a0c1..ef003c2bb8d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
@@ -135,7 +135,8 @@ __glusterd_defrag_notify (struct rpc_clnt *rpc, void *mydata,
UNLOCK (&defrag->lock);
if (!gf_is_service_running (pidfile, NULL)) {
- if (volinfo->rebal.defrag_status ==
+ if (volinfo->type != GF_CLUSTER_TYPE_TIER &&
+ volinfo->rebal.defrag_status ==
GF_DEFRAG_STATUS_STARTED) {
volinfo->rebal.defrag_status =
GF_DEFRAG_STATUS_FAILED;
@@ -198,9 +199,6 @@ glusterd_handle_defrag_start (glusterd_volinfo_t *volinfo, char *op_errstr,
GF_ASSERT (volinfo);
GF_ASSERT (op_errstr);
- if ((cmd == GF_OP_CMD_DETACH_START) &&
- (volinfo->rebal.defrag_status == GF_DEFRAG_STATUS_STARTED))
- return 0;
ret = glusterd_defrag_start_validate (volinfo, op_errstr, len, op);
if (ret)
@@ -607,6 +605,13 @@ glusterd_op_stage_rebalance (dict_t *dict, char **op_errstr)
ret = -1;
goto out;
}
+ if (glusterd_is_tier_daemon_running (volinfo)) {
+ ret = gf_asprintf (op_errstr, "A Tier daemon is "
+ "already running on volume %s",
+ volname);
+ ret = -1;
+ goto out;
+ }
case GF_DEFRAG_CMD_START:
case GF_DEFRAG_CMD_START_LAYOUT_FIX:
/* Check if the connected clients are all of version
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 48216f61989..1dcc3d3de50 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -5432,11 +5432,32 @@ out:
return ret;
}
+gf_boolean_t
+glusterd_is_tier_daemon_running (glusterd_volinfo_t *volinfo)
+{
+ if (volinfo->type != GF_CLUSTER_TYPE_TIER)
+ return _gf_false;
+
+ if (volinfo->rebal.defrag &&
+ volinfo->rebal.defrag_cmd == GF_DEFRAG_CMD_START_TIER) {
+ return _gf_true;
+ }
+
+ return _gf_false;
+
+}
+
+
int
glusterd_is_defrag_on (glusterd_volinfo_t *volinfo)
{
- /* Defrag is never enabled for tiered volumes. */
- if (volinfo->type == GF_CLUSTER_TYPE_TIER)
+ /*
+ * Do not need to consider tier daemon as a rebalance
+ * daemon and with current design rebalance is not supported
+ * on a tiered volume.
+ */
+
+ if (glusterd_is_tier_daemon_running (volinfo))
return 0;
return (volinfo->rebal.defrag != NULL);
@@ -6759,21 +6780,27 @@ glusterd_volume_defrag_restart (glusterd_volinfo_t *volinfo, char *op_errstr,
return ret;
}
+void
+glusterd_restart_rebalance_for_volume (glusterd_volinfo_t *volinfo)
+{
+
+ char op_errstr[PATH_MAX];
+ if (!volinfo->rebal.defrag_cmd)
+ return;
+ if (!gd_should_i_start_rebalance (volinfo))
+ return;
+ glusterd_volume_defrag_restart (volinfo, op_errstr, PATH_MAX,
+ volinfo->rebal.defrag_cmd, NULL);
+}
int
glusterd_restart_rebalance (glusterd_conf_t *conf)
{
glusterd_volinfo_t *volinfo = NULL;
int ret = 0;
- char op_errstr[256];
cds_list_for_each_entry (volinfo, &conf->volumes, vol_list) {
- if (!volinfo->rebal.defrag_cmd)
- continue;
- if (!gd_should_i_start_rebalance (volinfo))
- continue;
- glusterd_volume_defrag_restart (volinfo, op_errstr, 256,
- volinfo->rebal.defrag_cmd, NULL);
+ glusterd_restart_rebalance_for_volume (volinfo);
}
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h
index 7741087ff74..7bba897629d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.h
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.h
@@ -220,6 +220,10 @@ glusterd_brick_stop (glusterd_volinfo_t *volinfo,
glusterd_brickinfo_t *brickinfo,
gf_boolean_t del_brick);
+gf_boolean_t
+glusterd_is_tier_daemon_running (glusterd_volinfo_t *volinfo);
+
+
int
glusterd_is_defrag_on (glusterd_volinfo_t *volinfo);
@@ -357,6 +361,9 @@ glusterd_get_trusted_client_filepath (char *filepath,
int
glusterd_restart_rebalance (glusterd_conf_t *conf);
+void
+glusterd_restart_rebalance_for_volume (glusterd_volinfo_t *volinfo);
+
int32_t
glusterd_add_bricks_hname_path_to_dict (dict_t *dict,
glusterd_volinfo_t *volinfo);
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
index 13daceb42ad..a13ddcaff18 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -2425,6 +2425,10 @@ glusterd_op_start_volume (dict_t *dict, char **op_errstr)
goto out;
}
+ if (volinfo->type == GF_CLUSTER_TYPE_TIER) {
+ glusterd_restart_rebalance_for_volume (volinfo);
+ }
+
ret = glusterd_svcs_manager (volinfo);
out: