diff options
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-brick-ops.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-brick-ops.c | 44 |
1 files changed, 14 insertions, 30 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c index e08ea7be215..4d18eb3cd96 100644 --- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c @@ -351,10 +351,13 @@ __glusterd_handle_add_brick(rpcsvc_request_t *req) goto out; } - if (!(ret = glusterd_check_volume_exists(volname))) { - ret = -1; - snprintf(err_str, sizeof(err_str), "Volume %s does not exist", volname); - gf_msg(this->name, GF_LOG_ERROR, EINVAL, GD_MSG_VOL_NOT_FOUND, "%s", + ret = glusterd_volinfo_find(volname, &volinfo); + if (ret) { + snprintf(err_str, sizeof(err_str), + "Unable to get volinfo " + "for volume name %s", + volname); + gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_VOLINFO_GET_FAIL, "%s", err_str); goto out; } @@ -396,17 +399,6 @@ __glusterd_handle_add_brick(rpcsvc_request_t *req) goto out; } - ret = glusterd_volinfo_find(volname, &volinfo); - if (ret) { - snprintf(err_str, sizeof(err_str), - "Unable to get volinfo " - "for volume name %s", - volname); - gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_VOLINFO_GET_FAIL, "%s", - err_str); - goto out; - } - total_bricks = volinfo->brick_count + brick_count; if (dict_getn(dict, "attach-tier", SLEN("attach-tier"))) { @@ -3070,11 +3062,14 @@ __glusterd_handle_add_tier_brick(rpcsvc_request_t *req) goto out; } - if (!glusterd_check_volume_exists(volname)) { - snprintf(err_str, sizeof(err_str), "Volume %s does not exist", volname); - gf_msg(this->name, GF_LOG_ERROR, EINVAL, GD_MSG_VOL_NOT_FOUND, "%s", + ret = glusterd_volinfo_find(volname, &volinfo); + if (ret) { + snprintf(err_str, sizeof(err_str), + "Unable to get volinfo " + "for volume name %s", + volname); + gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_VOLINFO_GET_FAIL, "%s", err_str); - ret = -1; goto out; } @@ -3109,17 +3104,6 @@ __glusterd_handle_add_tier_brick(rpcsvc_request_t *req) goto out; } - ret = glusterd_volinfo_find(volname, &volinfo); - if (ret) { - snprintf(err_str, sizeof(err_str), - "Unable to get volinfo " - "for volume name %s", - volname); - gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_VOLINFO_GET_FAIL, "%s", - err_str); - goto out; - } - if (glusterd_is_tiering_supported(err_str) == _gf_false) { gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_VERSION_UNSUPPORTED, "Tiering not supported at this version"); |