diff options
author | hari gowtham <hgowtham@redhat.com> | 2017-01-23 16:38:00 +0530 |
---|---|---|
committer | Atin Mukherjee <amukherj@redhat.com> | 2017-08-01 11:08:04 +0000 |
commit | e5db980504bc4ace037ea806ad89a1ca897150d5 (patch) | |
tree | b1e1b7141d2b5467255aea4f3d679b1c09233216 /xlators/mgmt/glusterd/src/glusterd-mgmt.c | |
parent | 3023c4bd7651d4503830c36676cd08864e315cdf (diff) |
tier: separation of attach-tier from add-brick
PROBLEM: Both attach tier and add brick have the same RPC
and set of code. This becomes a hurdle while tring to implement
add brick on a tiered volume.
FIX: This patch separates the add brick and attach tier
giving them separate RPCs.
Change-Id: Iec57e972be968a9ff00b15b507e56a4f6dc398a2
BUG: 1376326
Signed-off-by: hari gowtham <hgowtham@redhat.com>
Reviewed-on: https://review.gluster.org/15503
Smoke: Gluster Build System <jenkins@build.gluster.org>
Tested-by: hari gowtham <hari.gowtham005@gmail.com>
Reviewed-by: Samikshan Bairagya <samikshan@gmail.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-mgmt.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-mgmt.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-mgmt.c index 7a7db069b6e..13a4526ebe0 100644 --- a/xlators/mgmt/glusterd/src/glusterd-mgmt.c +++ b/xlators/mgmt/glusterd/src/glusterd-mgmt.c @@ -169,6 +169,7 @@ gd_mgmt_v3_pre_validate_fn (glusterd_op_t op, dict_t *dict, goto out; } break; + case GD_OP_ADD_TIER_BRICK: case GD_OP_ADD_BRICK: ret = glusterd_op_stage_add_brick (dict, op_errstr, rsp_dict); if (ret) { @@ -391,6 +392,19 @@ gd_mgmt_v3_commit_fn (glusterd_op_t op, dict_t *dict, "tier status commit failed"); goto out; } + break; + } + case GD_OP_ADD_TIER_BRICK: + { + ret = glusterd_op_add_tier_brick (dict, op_errstr); + if (ret) { + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_COMMIT_OP_FAIL, + "tier add-brick commit failed."); + goto out; + } + break; + } default: @@ -492,6 +506,54 @@ gd_mgmt_v3_post_validate_fn (glusterd_op_t op, int32_t op_ret, dict_t *dict, } break; } + case GD_OP_ADD_TIER_BRICK: + { + ret = dict_get_str (dict, "volname", &volname); + if (ret) { + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get" + " volume name"); + goto out; + } + + ret = glusterd_volinfo_find (volname, &volinfo); + if (ret) { + gf_msg ("glusterd", GF_LOG_ERROR, EINVAL, + GD_MSG_VOL_NOT_FOUND, "Unable to " + "allocate memory"); + goto out; + } + ret = glusterd_create_volfiles_and_notify_services ( + volinfo); + if (ret) + goto out; + ret = glusterd_store_volinfo (volinfo, + GLUSTERD_VOLINFO_VER_AC_INCREMENT); + if (ret) + goto out; + ret = dict_get_str (dict, "volname", &volname); + if (ret) { + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get" + " volume name"); + goto out; + } + + volinfo->is_tier_enabled = _gf_true; + + if (ret) { + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_SET_FAILED, "dict set " + "failed"); + goto out; + } + ret = -1; + svc = &(volinfo->tierd.svc); + ret = svc->manager (svc, volinfo, + PROC_START_NO_WAIT); + if (ret) + goto out; + } default: break; @@ -755,6 +817,7 @@ glusterd_pre_validate_aggr_rsp_dict (glusterd_op_t op, break; case GD_OP_START_VOLUME: case GD_OP_ADD_BRICK: + case GD_OP_ADD_TIER_BRICK: ret = glusterd_aggr_brick_mount_dirs (aggr, rsp); if (ret) { gf_msg (this->name, GF_LOG_ERROR, 0, @@ -1085,6 +1148,7 @@ glusterd_mgmt_v3_build_payload (dict_t **req, char **op_errstr, dict_t *dict, case GD_OP_ADD_BRICK: case GD_OP_REPLACE_BRICK: case GD_OP_RESET_BRICK: + case GD_OP_ADD_TIER_BRICK: { ret = dict_get_str (dict, "volname", &volname); if (ret) { |