From 28980e69cf720a614fdd6666da5021524bc1f071 Mon Sep 17 00:00:00 2001 From: Pranith K Date: Tue, 28 Sep 2010 23:28:28 +0000 Subject: mgmt/glusterd: brick info get should compare uuid instead of hostname Signed-off-by: Pranith Kumar K Signed-off-by: Vijay Bellur BUG: 1734 (replace brick should accept both ipaddress and hostname for bricks) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1734 --- xlators/mgmt/glusterd/src/glusterd-utils.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 71f23a8f1..d1d45a75c 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -651,6 +651,7 @@ glusterd_brickinfo_get (char *brick, glusterd_volinfo_t *volinfo, char *dup_brick = NULL; char *free_ptr = NULL; glusterd_brickinfo_t *tmp = NULL; + uuid_t uuid = {0}; GF_ASSERT (brick); GF_ASSERT (brickinfo); @@ -679,18 +680,20 @@ glusterd_brickinfo_get (char *brick, glusterd_volinfo_t *volinfo, goto out; } + ret = glusterd_hostname_to_uuid (hostname, uuid); + if (ret) + goto out; list_for_each_entry (tmp, &volinfo->bricks, brick_list) { - if ((!strcmp (tmp->hostname, hostname)) && + if ((!uuid_compare (uuid, tmp->uuid)) && !strcmp (tmp->path, path)) { gf_log ("", GF_LOG_NORMAL, "Found brick"); ret = 0; + *brickinfo = tmp; break; } } - *brickinfo = tmp; - out: if (free_ptr) GF_FREE (free_ptr); -- cgit