From f846e54b8844decbc8bd73840e7d35b2dcaed2e0 Mon Sep 17 00:00:00 2001 From: Avra Sengupta Date: Wed, 23 Apr 2014 04:26:24 +0000 Subject: glusterd: Fetch brick mount_dirs during brick create. Fetch the mount directory path for a brick, during volume create, add-brick, and replace-brick. When a snap-create is missed, use this mount directory information to create the brick path for the missed snap brick. Change-Id: Iad3eec96a32cf340f26bdf3f28e2f529e4b77e31 BUG: 1061685 Signed-off-by: Avra Sengupta Reviewed-on: http://review.gluster.org/7550 Reviewed-by: Rajesh Joseph Tested-by: Gluster Build System Reviewed-by: Krishnan Parthasarathi Tested-by: Krishnan Parthasarathi --- xlators/mgmt/glusterd/src/glusterd-op-sm.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 30658459ba7..d6d72516c67 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -3373,6 +3373,7 @@ glusterd_op_ac_send_stage_op (glusterd_op_sm_event_t *event, void *ctx) xlator_t *this = NULL; glusterd_peerinfo_t *peerinfo = NULL; dict_t *dict = NULL; + dict_t *rsp_dict = NULL; char *op_errstr = NULL; glusterd_op_t op = GD_OP_NONE; uint32_t pending_count = 0; @@ -3384,6 +3385,13 @@ glusterd_op_ac_send_stage_op (glusterd_op_sm_event_t *event, void *ctx) op = glusterd_op_get_op (); + rsp_dict = dict_new(); + if (!rsp_dict) { + gf_log (this->name, GF_LOG_ERROR, "Failed to create rsp_dict"); + ret = -1; + goto out; + } + ret = glusterd_op_build_payload (&dict, &op_errstr, NULL); if (ret) { gf_log (this->name, GF_LOG_ERROR, LOGSTR_BUILD_PAYLOAD, @@ -3401,8 +3409,7 @@ glusterd_op_ac_send_stage_op (glusterd_op_sm_event_t *event, void *ctx) goto out; } - /* rsp_dict NULL from source */ - ret = glusterd_op_stage_validate (op, dict, &op_errstr, NULL); + ret = glusterd_op_stage_validate (op, dict, &op_errstr, rsp_dict); if (ret) { gf_log (this->name, GF_LOG_ERROR, LOGSTR_STAGE_FAIL, gd_op_list[op], "localhost", @@ -3414,6 +3421,9 @@ glusterd_op_ac_send_stage_op (glusterd_op_sm_event_t *event, void *ctx) goto out; } + if (op == GD_OP_REPLACE_BRICK) + glusterd_rb_use_rsp_dict (NULL, rsp_dict); + list_for_each_entry (peerinfo, &priv->peers, uuid_list) { GF_ASSERT (peerinfo); @@ -3447,6 +3457,9 @@ glusterd_op_ac_send_stage_op (glusterd_op_sm_event_t *event, void *ctx) opinfo.pending_count = pending_count; out: + if (rsp_dict) + dict_unref (rsp_dict); + if (dict) dict_unref (dict); if (ret) { @@ -4586,11 +4599,13 @@ glusterd_op_stage_validate (glusterd_op_t op, dict_t *dict, char **op_errstr, switch (op) { case GD_OP_CREATE_VOLUME: - ret = glusterd_op_stage_create_volume (dict, op_errstr); + ret = glusterd_op_stage_create_volume (dict, op_errstr, + rsp_dict); break; case GD_OP_START_VOLUME: - ret = glusterd_op_stage_start_volume (dict, op_errstr); + ret = glusterd_op_stage_start_volume (dict, op_errstr, + rsp_dict); break; case GD_OP_STOP_VOLUME: @@ -4602,7 +4617,8 @@ glusterd_op_stage_validate (glusterd_op_t op, dict_t *dict, char **op_errstr, break; case GD_OP_ADD_BRICK: - ret = glusterd_op_stage_add_brick (dict, op_errstr); + ret = glusterd_op_stage_add_brick (dict, op_errstr, + rsp_dict); break; case GD_OP_REPLACE_BRICK: -- cgit