summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
diff options
context:
space:
mode:
authorKrishnan Parthasarathi <kparthas@redhat.com>2012-07-12 17:35:37 +0530
committerAnand Avati <avati@redhat.com>2012-07-19 09:09:33 -0700
commit9f5b8911b484230304fa52c0fcd92f696a4af74a (patch)
tree39c349e2bec47d1078d8452d84125f16928cdff4 /xlators/mgmt/glusterd/src/glusterd-volume-ops.c
parentc0b07bdf5d253cf5620726f149700960e962b8ec (diff)
glusterd: Refactored brickinfo APIs
This patch modifies the existing brickinfo function signatures and/or names to do one thing right and call them by 'appropriate' names. - Decoupled brickinfo_get and is_brickpath_available - Removed dead comment about realpath(3) in canonicalize_path - Renamed glusterd_brickinfo_from_brick to glusterd_brickinfo_new_from_brick to make the name of the function reflect that an allocation is happening Change-Id: I29daba6d431ca799d43c927b9dfbaeda327e83e8 BUG: 764890 Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-on: http://review.gluster.com/3668 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-volume-ops.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-ops.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
index f706ac67436..829985022a6 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -58,7 +58,6 @@ glusterd_handle_create_volume (rpcsvc_request_t *req)
char *trans_type = NULL;
uuid_t volume_id = {0,};
uuid_t tmp_uuid = {0};
- glusterd_brickinfo_t *tmpbrkinfo = NULL;
glusterd_volinfo_t tmpvolinfo = {{0},};
int32_t type = 0;
char *username = NULL;
@@ -126,12 +125,12 @@ glusterd_handle_create_volume (rpcsvc_request_t *req)
}
ret = dict_get_int32 (dict, "type", &type);
- /*if (ret) {
+ if (ret) {
gf_log ("", GF_LOG_ERROR, "Unable to get type");
snprintf (err_str, sizeof (err_str), "Unable to get volume "
"type");
goto out;
- }*/
+ }
ret = dict_get_str (dict, "transport", &trans_type);
if (ret) {
@@ -173,7 +172,7 @@ glusterd_handle_create_volume (rpcsvc_request_t *req)
i++;
brick= strtok_r (brick_list, " \n", &tmpptr);
brick_list = tmpptr;
- ret = glusterd_brickinfo_from_brick (brick, &brickinfo);
+ ret = glusterd_brickinfo_new_from_brick (brick, &brickinfo);
if (ret) {
snprintf (err_str, sizeof (err_str), "Unable to get "
"brick info from brick %s", brick);
@@ -184,18 +183,7 @@ glusterd_handle_create_volume (rpcsvc_request_t *req)
sizeof (err_str));
if (ret)
goto out;
- ret = glusterd_volume_brickinfo_get (brickinfo->uuid,
- brickinfo->hostname,
- brickinfo->path,
- &tmpvolinfo, &tmpbrkinfo,
- GF_PATH_PARTIAL);
- if (!ret) {
- ret = -1;
- snprintf (err_str, sizeof (err_str), "Brick: %s:%s, %s"
- " one of the bricks contain the other",
- tmpbrkinfo->hostname, tmpbrkinfo->path, brick);
- goto out;
- }
+
list_add_tail (&brickinfo->brick_list, &tmpvolinfo.bricks);
brickinfo = NULL;
}
@@ -701,7 +689,7 @@ glusterd_op_stage_create_volume (dict_t *dict, char **op_errstr)
goto out;
}
- ret = glusterd_brickinfo_from_brick (brick, &brick_info);
+ ret = glusterd_brickinfo_new_from_brick (brick, &brick_info);
if (ret)
goto out;
snprintf (cmd_str, 1024, "%s", brick_info->path);
@@ -1396,7 +1384,7 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr)
brick = strtok_r (brick_list+1, " \n", &saveptr);
while ( i <= count) {
- ret = glusterd_brickinfo_from_brick (brick, &brickinfo);
+ ret = glusterd_brickinfo_new_from_brick (brick, &brickinfo);
if (ret)
goto out;