summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorSakshi <sabansal@redhat.com>2015-05-26 09:53:55 +0530
committerRaghavendra Talur <rtalur@redhat.com>2016-04-28 23:59:42 -0700
commita8e4a633d5ee42cbbf747ba31f5e3295e6d20ac0 (patch)
treea3fab40015952fab43c3922b36b82a60e6f5d9cf /xlators/mgmt
parentb1d95449adbb40bfccef116914e43d08efae44af (diff)
glusterd: check if glusterd is started on all nodes and all
bricks are started before performing rebalance Backport of http://review.gluster.org/#/c/10906/ > Change-Id: I458ea9cd86cf35bdb7d758be55f951ae9f3e66f0 > BUG: 1224857 > Signed-off-by: Sakshi <sabansal@redhat.com> > Reviewed-on: http://review.gluster.org/10906 > Smoke: Gluster Build System <jenkins@build.gluster.com> > CentOS-regression: Gluster Build System <jenkins@build.gluster.com> > NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> > Reviewed-by: Atin Mukherjee <amukherj@redhat.com> BUG: 1312722 Change-Id: Ib8e59b33e064be8301f682a4b08cb5cf10c22fc9 Signed-off-by: Sakshi <sabansal@redhat.com> Signed-off-by: Raghavendra Talur <rtalur@redhat.com> Reviewed-on: http://review.gluster.org/13537 Smoke: Gluster Build System <jenkins@build.gluster.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rebalance.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
index 7112e599467..43c3472fe5a 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
@@ -637,6 +637,8 @@ glusterd_op_stage_rebalance (dict_t *dict, char **op_errstr)
int32_t cmd = 0;
char msg[2048] = {0};
glusterd_volinfo_t *volinfo = NULL;
+ glusterd_brickinfo_t *brickinfo = NULL;
+ glusterd_peerinfo_t *peerinfo = NULL;
char *task_id_str = NULL;
dict_t *op_ctx = NULL;
xlator_t *this = 0;
@@ -704,6 +706,41 @@ glusterd_op_stage_rebalance (dict_t *dict, char **op_errstr)
goto out;
}
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks,
+ brick_list) {
+ if (glusterd_is_local_brick (THIS, volinfo, brickinfo)) {
+ if (brickinfo->status != GF_BRICK_STARTED) {
+ gf_asprintf (op_errstr, "Received"
+ " rebalance on volume with "
+ " stopped brick %s",
+ brickinfo->path);
+ ret = -1;
+ goto out;
+ }
+ } else {
+ rcu_read_lock ();
+ peerinfo = glusterd_peerinfo_find_by_uuid
+ (brickinfo->uuid);
+ if (!peerinfo) {
+ gf_asprintf (op_errstr, "Host node of "
+ "brick %s doesn't belong "
+ "to cluster",
+ brickinfo->path);
+ ret = -1;
+ rcu_read_unlock ();
+ goto out;
+ } else if (!peerinfo->connected) {
+ gf_asprintf (op_errstr, "Host node of "
+ "brick %s is down",
+ brickinfo->path);
+ ret = -1;
+ rcu_read_unlock ();
+ goto out;
+ }
+ rcu_read_unlock ();
+ }
+ }
+
case GF_DEFRAG_CMD_START_FORCE:
if (is_origin_glusterd (dict)) {
op_ctx = glusterd_op_get_ctx ();