summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src
diff options
context:
space:
mode:
authorSanju Rakonde <srakonde@redhat.com>2018-11-06 19:44:16 +0530
committerShyamsundar Ranganathan <srangana@redhat.com>2018-11-08 17:07:42 +0000
commitb651cb3e612214c8fdb434af2b95ca0c018b5c36 (patch)
treeba83973727ccd9ef2cf7b6c064fbcdfd150dd0ed /xlators/mgmt/glusterd/src
parent7462a4dd92ea97b399d2321973ecdff0791ce3bd (diff)
glusterd: allow shared-storage to use bricks under glusterd working directory
With commit 44e4db, we are not allowing user to create a volume using glusterd's working directory as a brick or any sub directory under glusterd's working directory as a brick.This has broken shared-storage since the volume "gluster-shared-storage" is created using the bricks under glusterd's working directory. With this patch, we let the "gluster-shared-storage" volume to use bricks under glusterd's working directory. > BUG: bz#1647029 > Change-Id: Ifcbcf4576eea12cf46f199dea287b29bd3ec3bfd > Signed-off-by: Sanju Rakonde <srakonde@redhat.com> (cherry picked from commit bdb4ca184913c82ccf9552298f5d5b597794f2aa) fixes: bz#1647801 Change-Id: Ifcbcf4576eea12cf46f199dea287b29bd3ec3bfd Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-brick-ops.c3
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-replace-brick.c3
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-reset-brick.c4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c9
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.h4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-ops.c3
6 files changed, 15 insertions, 11 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
index d4bc8b21cad..7328f0c38bd 100644
--- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
@@ -1904,7 +1904,8 @@ glusterd_op_stage_add_brick(dict_t *dict, char **op_errstr, dict_t *rsp_dict)
#endif
ret = glusterd_validate_and_create_brickpath(
- brickinfo, volinfo->volume_id, op_errstr, is_force, _gf_false);
+ brickinfo, volinfo->volume_id, volinfo->volname, op_errstr,
+ is_force, _gf_false);
if (ret)
goto out;
diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
index 1248910990f..7a75cf81aad 100644
--- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
+++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
@@ -261,7 +261,8 @@ glusterd_op_stage_replace_brick(dict_t *dict, char **op_errstr,
if (gf_is_local_addr(host)) {
ret = glusterd_validate_and_create_brickpath(
- dst_brickinfo, volinfo->volume_id, op_errstr, is_force, _gf_false);
+ dst_brickinfo, volinfo->volume_id, volinfo->volname, op_errstr,
+ is_force, _gf_false);
if (ret)
goto out;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-reset-brick.c b/xlators/mgmt/glusterd/src/glusterd-reset-brick.c
index 1fb6ea7fd1f..41adc40b5ce 100644
--- a/xlators/mgmt/glusterd/src/glusterd-reset-brick.c
+++ b/xlators/mgmt/glusterd/src/glusterd-reset-brick.c
@@ -148,8 +148,8 @@ glusterd_reset_brick_prevalidate(dict_t *dict, char **op_errstr,
ret = 0;
if (gf_is_local_addr(host)) {
ret = glusterd_validate_and_create_brickpath(
- dst_brickinfo, volinfo->volume_id, op_errstr, is_force,
- ignore_partition);
+ dst_brickinfo, volinfo->volume_id, volinfo->volname, op_errstr,
+ is_force, ignore_partition);
if (ret)
goto out;
} else {
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 40109ccb954..9bb3bc4ba33 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -1468,8 +1468,8 @@ out:
int
glusterd_validate_and_create_brickpath(glusterd_brickinfo_t *brickinfo,
- uuid_t volume_id, char **op_errstr,
- gf_boolean_t is_force,
+ uuid_t volume_id, char *volname,
+ char **op_errstr, gf_boolean_t is_force,
gf_boolean_t ignore_partition)
{
int ret = -1;
@@ -1544,8 +1544,9 @@ glusterd_validate_and_create_brickpath(glusterd_brickinfo_t *brickinfo,
parentdir, strerror(errno));
goto out;
}
-
- if (sizeof(GLUSTERD_DEFAULT_WORKDIR) <= (strlen(brickinfo->path) + 1) &&
+ if (strncmp(volname, GLUSTER_SHARED_STORAGE,
+ SLEN(GLUSTER_SHARED_STORAGE)) &&
+ sizeof(GLUSTERD_DEFAULT_WORKDIR) <= (strlen(brickinfo->path) + 1) &&
!strncmp(brickinfo->path, GLUSTERD_DEFAULT_WORKDIR,
(sizeof(GLUSTERD_DEFAULT_WORKDIR) - 1))) {
len = snprintf(msg, sizeof(msg),
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h
index 4bdc048dd35..cffbebda70c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.h
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.h
@@ -329,8 +329,8 @@ glusterd_check_and_set_brick_xattr(char *host, char *path, uuid_t uuid,
int
glusterd_validate_and_create_brickpath(glusterd_brickinfo_t *brickinfo,
- uuid_t volume_id, char **op_errstr,
- gf_boolean_t is_force,
+ uuid_t volume_id, char *volname,
+ char **op_errstr, gf_boolean_t is_force,
gf_boolean_t ignore_partition);
int
glusterd_sm_tr_log_transition_add(glusterd_sm_tr_log_t *log, int old_state,
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
index a6561e101d5..2e0fe168807 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -1381,7 +1381,8 @@ glusterd_op_stage_create_volume(dict_t *dict, char **op_errstr,
}
#endif
ret = glusterd_validate_and_create_brickpath(
- brick_info, volume_uuid, op_errstr, is_force, _gf_false);
+ brick_info, volume_uuid, volname, op_errstr, is_force,
+ _gf_false);
if (ret)
goto out;