diff options
author | Pranith K <pranithk@gluster.com> | 2010-09-28 23:28:28 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-09-28 22:58:26 -0700 |
commit | 28980e69cf720a614fdd6666da5021524bc1f071 (patch) | |
tree | 95c36a9c1e24fee690f73057ca2bfa96f2e03d9f | |
parent | 4e72e3ac439bab76880236a87558fc54009c007c (diff) |
mgmt/glusterd: brick info get should compare uuid instead of hostname
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
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
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 71f23a8f139..d1d45a75c9c 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); |