From 38d73bdfc659dde4a2632da2da01c785b642c728 Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Mon, 13 Feb 2012 16:33:32 +0530 Subject: glusterd: Fail volume 'modify' operations when rb is ongoing * add-brick, stop-volume, remove-brick are the operations that are explicitly 'failed' when attempted while replace-brick is in progress. * we attach the volume-id to the dst_brick volfile ensuring that the replace-brick operation holds 'claim' on it. Change-Id: If60b2af566ca940b2add600b473c99730e06ab47 BUG: 765470 Signed-off-by: Krishnan Parthasarathi Reviewed-on: http://review.gluster.com/2740 Tested-by: Gluster Build System Reviewed-by: Amar Tumballi Reviewed-by: Vijay Bellur --- xlators/mgmt/glusterd/src/glusterd-replace-brick.c | 61 +--------------------- 1 file changed, 2 insertions(+), 59 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-replace-brick.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c index 92ae963a1..40202dd82 100644 --- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c +++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c @@ -169,65 +169,6 @@ out: return ret; } - -char * -glusterd_check_brick_rb_part (char *bricks, int count, glusterd_volinfo_t *volinfo) -{ - char *saveptr = NULL; - char *brick = NULL; - char *brick_list = NULL; - int ret = 0; - glusterd_brickinfo_t *brickinfo = NULL; - uint32_t i = 0; - char *str = NULL; - char msg[2048] = {0,}; - - brick_list = gf_strdup (bricks); - if (!brick_list) { - gf_log ("glusterd", GF_LOG_ERROR, - "Out of memory"); - ret = -1; - goto out; - } - - if (count) - brick = strtok_r (brick_list+1, " \n", &saveptr); - - - while ( i < count) { - ret = glusterd_brickinfo_from_brick (brick, &brickinfo); - if (ret) { - snprintf (msg, sizeof(msg), "Unable to" - " get brickinfo"); - gf_log ("", GF_LOG_ERROR, "%s", msg); - ret = -1; - goto out; - } - - if (glusterd_is_replace_running (volinfo, brickinfo)) { - snprintf (msg, sizeof(msg), "Volume %s: replace brick is running" - " and the brick %s:%s you are trying to add is the destination brick" - " for replace brick", volinfo->volname, brickinfo->hostname, brickinfo->path); - ret = -1; - goto out; - } - - glusterd_brickinfo_delete (brickinfo); - brickinfo = NULL; - brick = strtok_r (NULL, " \n", &saveptr); - i++; - } - -out: - if (brick_list) - GF_FREE(brick_list); - if (brickinfo) - glusterd_brickinfo_delete (brickinfo); - if (ret) - str = gf_strdup (msg); - return str; -} - static int glusterd_get_rb_dst_brickinfo (glusterd_volinfo_t *volinfo, glusterd_brickinfo_t **brickinfo) @@ -826,6 +767,7 @@ out: static const char *dst_brick_volfile_str = "volume src-posix\n" " type storage/posix\n" " option directory %s\n" + " option volume-id %s\n" "end-volume\n" "volume %s\n" " type features/locks\n" @@ -872,6 +814,7 @@ rb_generate_dst_brick_volfile (glusterd_volinfo_t *volinfo, } fprintf (file, dst_brick_volfile_str, dst_brickinfo->path, + uuid_utoa (volinfo->volume_id), dst_brickinfo->path, dst_brickinfo->path, trans_type, dst_brickinfo->path); -- cgit