diff options
author | Krutika Dhananjay <kdhananj@redhat.com> | 2013-05-15 17:30:30 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2013-05-25 11:43:19 -0700 |
commit | cb50f94f4299856046e1f1677ad1c8152de06136 (patch) | |
tree | fb2681480665115300d58dcd20274885f8b3d292 /xlators/mgmt/glusterd/src/glusterd-volume-ops.c | |
parent | 689618e2fc0cecbfa06ef02b6c259a1a8502971f (diff) |
glusterd: Allow volume start force to succeed if brick directories are recreated
Change-Id: I4fc3c5c829adca256bb131f4a2722abc95741158
BUG: 963665
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-on: http://review.gluster.org/5020
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-volume-ops.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c index 0cae8d58b33..17b3f6182f7 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c @@ -924,13 +924,27 @@ glusterd_op_stage_start_volume (dict_t *dict, char **op_errstr) } ret = sys_lgetxattr (brickinfo->path, GF_XATTR_VOL_ID_KEY, volume_id, 16); - if (ret < 0) { + if (ret < 0 && (!(flags & GF_CLI_FLAG_OP_FORCE))) { snprintf (msg, sizeof (msg), "Failed to get " "extended attribute %s for brick dir %s. " "Reason : %s", GF_XATTR_VOL_ID_KEY, brickinfo->path, strerror (errno)); ret = -1; goto out; + } else if (ret < 0) { + ret = sys_lsetxattr (brickinfo->path, + GF_XATTR_VOL_ID_KEY, + volinfo->volume_id, 16, + XATTR_CREATE); + if (ret) { + snprintf (msg, sizeof (msg), "Failed to set " + "extended attribute %s on %s. Reason: " + "%s", GF_XATTR_VOL_ID_KEY, + brickinfo->path, strerror (errno)); + goto out; + } else { + continue; + } } if (uuid_compare (volinfo->volume_id, volume_id)) { snprintf (msg, sizeof (msg), "Volume id mismatch for " |