diff options
author | Krutika Dhananjay <kdhananj@redhat.com> | 2012-11-19 17:21:49 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-02-06 23:39:52 -0800 |
commit | 7a9e27073789bdc0164cc6428aee5088a8faa2fb (patch) | |
tree | 765cfcbc78081fbc618b4d83139587e106a89ea8 /xlators/mgmt/glusterd | |
parent | 0b7cdbf50dea9ee77bc8f71526a1566945672c19 (diff) |
glusterd: synctaskize 'volume create' operation
.. and also move brickpath validation to volume create stage
Change-Id: Ia028677932ca5f6aa05dcf624f47033b62e7b212
BUG: 862834
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-on: http://review.gluster.org/4213
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 48 |
1 files changed, 6 insertions, 42 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c index 3734bf7f82a..60f671efd92 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c @@ -36,14 +36,9 @@ glusterd_handle_create_volume (rpcsvc_request_t *req) int32_t ret = -1; gf_cli_req cli_req = {{0,}}; dict_t *dict = NULL; - glusterd_brickinfo_t *brickinfo = NULL; - char *brick = NULL; char *bricks = NULL; char *volname = NULL; int brick_count = 0; - char *tmpptr = NULL; - int i = 0; - char *brick_list = NULL; void *cli_rsp = NULL; char err_str[2048] = {0,}; gf_cli_rsp rsp = {0,}; @@ -52,15 +47,12 @@ glusterd_handle_create_volume (rpcsvc_request_t *req) char *trans_type = NULL; uuid_t volume_id = {0,}; uuid_t tmp_uuid = {0}; - glusterd_volinfo_t tmpvolinfo = {{0},}; int32_t type = 0; char *username = NULL; char *password = NULL; GF_ASSERT (req); - INIT_LIST_HEAD (&tmpvolinfo.bricks); - this = THIS; GF_ASSERT(this); @@ -153,31 +145,6 @@ glusterd_handle_create_volume (rpcsvc_request_t *req) } free_ptr = NULL; - if (bricks) { - brick_list = gf_strdup (bricks); - free_ptr = brick_list; - } - - while ( i < brick_count) { - i++; - brick= strtok_r (brick_list, " \n", &tmpptr); - brick_list = tmpptr; - ret = glusterd_brickinfo_new_from_brick (brick, &brickinfo); - if (ret) { - snprintf (err_str, sizeof (err_str), "Failed to create " - "brickinfo for brick %s", brick); - goto out; - } - - ret = glusterd_new_brick_validate (brick, brickinfo, err_str, - sizeof (err_str)); - if (ret) - goto out; - - list_add_tail (&brickinfo->brick_list, &tmpvolinfo.bricks); - brickinfo = NULL; - } - /* generate internal username and password */ uuid_generate (tmp_uuid); @@ -198,8 +165,7 @@ glusterd_handle_create_volume (rpcsvc_request_t *req) goto out; } - ret = glusterd_op_begin (req, GD_OP_CREATE_VOLUME, dict, err_str, - sizeof (err_str)); + ret = glusterd_op_begin_synctask (req, GD_OP_CREATE_VOLUME, dict); out: if (ret) { @@ -217,13 +183,6 @@ out: GF_FREE(free_ptr); - glusterd_volume_brickinfos_delete (&tmpvolinfo); - if (brickinfo) - glusterd_brickinfo_delete (brickinfo); - - glusterd_friend_sm (); - glusterd_op_sm (); - return ret; } @@ -746,6 +705,11 @@ glusterd_op_stage_create_volume (dict_t *dict, char **op_errstr) if (ret) goto out; + ret = glusterd_new_brick_validate (brick, brick_info, msg, + sizeof (msg)); + if (ret) + goto out; + ret = glusterd_resolve_brick (brick_info); if (ret) { gf_log (this->name, GF_LOG_ERROR, FMTSTR_RESOLVE_BRICK, |