summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-op-sm.c
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2012-03-16 16:09:42 +0530
committerAnand Avati <avati@redhat.com>2012-03-18 00:33:28 -0700
commit642343cc55e6ea2b0d463d77334c34790c30080f (patch)
tree47aa3e890088463828e936b84ccb56b2fdc49152 /xlators/mgmt/glusterd/src/glusterd-op-sm.c
parentf159e2247b58441449ad8da13ddf5cc5d3887b93 (diff)
Self-heald: Handle errors gracefully and show errors to users
Change-Id: I5424ebfadb5b2773ee6f7370cc2867a555aa48dd BUG: 800352 Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Reviewed-on: http://review.gluster.com/2962 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index d96d6717eeb..ce9581644b1 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -2780,9 +2780,9 @@ _heal_volume_add_shd_rsp (dict_t *this, char *key, data_t *value, void *data)
int rxl_child_id = 0;
int brick_id = 0;
int int_len = 0;
- int brick_count = 0;
int ret = 0;
glusterd_heal_rsp_conv_t *rsp_ctx = NULL;
+ glusterd_brickinfo_t *brickinfo = NULL;
rsp_ctx = data;
rxl_end = strchr (key, '-');
@@ -2810,13 +2810,19 @@ _heal_volume_add_shd_rsp (dict_t *this, char *key, data_t *value, void *data)
volinfo = rsp_ctx->volinfo;
brick_id = rxl_id * volinfo->replica_count + rxl_child_id;
+ if (!strcmp (rxl_child_end, "status")) {
+ brickinfo = glusterd_get_brickinfo_by_position (volinfo,
+ brick_id);
+ if (!brickinfo)
+ goto out;
+ if (!glusterd_is_local_brick (rsp_ctx->this, volinfo,
+ brickinfo))
+ goto out;
+ }
new_value = data_copy (value);
snprintf (new_key, sizeof (new_key), "%d%s", brick_id, rxl_child_end);
dict_set (rsp_ctx->dict, new_key, new_value);
- ret = dict_get_int32 (rsp_ctx->dict, "count", &brick_count);
- if (brick_id >= brick_count)
- ret = dict_set_int32 (rsp_ctx->dict, "count", brick_id + 1);
out:
return;
}
@@ -2847,6 +2853,7 @@ glusterd_heal_volume_brick_rsp (dict_t *req_dict, dict_t *rsp_dict,
rsp_ctx.dict = op_ctx;
rsp_ctx.volinfo = volinfo;
+ rsp_ctx.this = THIS;
dict_foreach (rsp_dict, _heal_volume_add_shd_rsp, &rsp_ctx);
out: