From 7817de70fedaeffbc320ffb629c1ff6c14f81ecd Mon Sep 17 00:00:00 2001 From: Rajesh Joseph Date: Tue, 11 Mar 2014 16:28:44 +0530 Subject: snapshot/restore: Restore failed in multiple node test Failed to set extended attribute on bricks on some nodes. Extended attribute should only be set for local node. Change-Id: Ib5b47b15d2f6f93e146d3d75e9061fccc9570a80 Signed-off-by: Rajesh Joseph Reviewed-on: http://review.gluster.org/7213 Reviewed-by: Sachin Pandit Tested-by: Sachin Pandit Reviewed-by: Avra Sengupta Tested-by: Avra Sengupta --- xlators/mgmt/glusterd/src/glusterd-utils.c | 33 ++++++++++++++++-------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 90becf346..0c16507d4 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -619,21 +619,24 @@ glusterd_snap_volinfo_restore (glusterd_volinfo_t *new_volinfo, goto out; } - /* We need to replace the volume id of all the bricks - * to the volume id of the origin volume. new_volinfo - * has the origin volume's volume id*/ - ret = sys_lsetxattr (new_brickinfo->path, - GF_XATTR_VOL_ID_KEY, - new_volinfo->volume_id, - sizeof (new_volinfo->volume_id), - XATTR_REPLACE); - if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to set " - "extended attribute %s on %s. Reason: " - "%s, snap: %s", GF_XATTR_VOL_ID_KEY, - new_brickinfo->path, strerror (errno), - new_volinfo->volname); - goto out; + if (!uuid_compare (brickinfo->uuid, MY_UUID)) { + /* We need to replace the volume id of all the bricks + * to the volume id of the origin volume. new_volinfo + * has the origin volume's volume id*/ + ret = sys_lsetxattr (new_brickinfo->path, + GF_XATTR_VOL_ID_KEY, + new_volinfo->volume_id, + sizeof (new_volinfo->volume_id), + XATTR_REPLACE); + if (ret) { + gf_log (this->name, GF_LOG_ERROR, "Failed to " + "set extended attribute %s on %s. " + "Reason: %s, snap: %s", + GF_XATTR_VOL_ID_KEY, + new_brickinfo->path, strerror (errno), + new_volinfo->volname); + goto out; + } } list_add_tail (&new_brickinfo->brick_list, &new_volinfo->bricks); -- cgit