summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd
diff options
context:
space:
mode:
authorVijay Bellur <vbellur@redhat.com>2013-08-31 22:34:02 +0530
committerAnand Avati <avati@redhat.com>2013-10-17 17:16:16 -0700
commitb2a9cbe5ce61ce170a55fb3dfd7f2d6de9c52f97 (patch)
tree91e67610781c09e8d2f4239890c354fc7286c6d5 /xlators/mgmt/glusterd
parent9d9ed58b3be5f3513b20146984c4bbacbc8d8750 (diff)
mgmt/glusterd: Relax extended attribute checks for volume create and add brick force.
Expectation with force is that user is aware of the consequences of sanity checks not being triggered. Change-Id: I79dfeed16a23829a7217cef33ab83f9f0ffae336 Signed-off-by: Vijay Bellur <vbellur@redhat.com> BUG: 1007509 Reviewed-on: http://review.gluster.org/5746 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c13
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.h2
2 files changed, 10 insertions, 5 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 21b5d746c6e..d4f33f2cefc 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -827,7 +827,7 @@ glusterd_validate_and_create_brickpath (glusterd_brickinfo_t *brickinfo,
ret = glusterd_check_and_set_brick_xattr (brickinfo->hostname,
brickinfo->path, volume_id,
- op_errstr);
+ op_errstr, is_force);
if (ret)
goto out;
@@ -5105,11 +5105,12 @@ out:
int
glusterd_check_and_set_brick_xattr (char *host, char *path, uuid_t uuid,
- char **op_errstr)
+ char **op_errstr, gf_boolean_t is_force)
{
int ret = -1;
char msg[2048] = {0,};
gf_boolean_t in_use = _gf_false;
+ int flags = 0;
/* Check for xattr support in backend fs */
ret = sys_lsetxattr (path, "trusted.glusterfs.test",
@@ -5129,13 +5130,17 @@ glusterd_check_and_set_brick_xattr (char *host, char *path, uuid_t uuid,
if (ret)
goto out;
- if (in_use) {
+ if (in_use && !is_force) {
ret = -1;
goto out;
}
+
+ if (!is_force)
+ flags = XATTR_CREATE;
+
ret = sys_lsetxattr (path, GF_XATTR_VOL_ID_KEY, uuid, 16,
- XATTR_CREATE);
+ flags);
if (ret) {
snprintf (msg, sizeof (msg), "Failed to set extended "
"attributes %s, reason: %s",
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h
index 34143cf6268..024675c7fbb 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.h
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.h
@@ -318,7 +318,7 @@ glusterd_rb_check_bricks (glusterd_volinfo_t *volinfo,
int
glusterd_check_and_set_brick_xattr (char *host, char *path, uuid_t uuid,
- char **op_errstr);
+ char **op_errstr, gf_boolean_t is_force);
int
glusterd_validate_and_create_brickpath (glusterd_brickinfo_t *brickinfo,