summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorGaurav Kumar Garg <garg.gaurav52@gmail.com>2016-03-14 14:36:11 +0530
committerAtin Mukherjee <amukherj@redhat.com>2016-03-21 10:55:48 -0700
commit9b3a1d1c51df28e3a0301082819c78fae0e8fb68 (patch)
tree65e12858bb82690a53f7c80832671c909d414c94 /xlators/mgmt
parentc713c94d9173e72ee6a60e64f001bdb6a35d8cf0 (diff)
glusterd: disabling enable-shared-storage option should not delete volume
This patch is a backport of: http://review.gluster.org/#/c/12232/ Previously, when you create volume with "glusterd_shared_storage" name and if user disable, enable-shared-storage option then gluster will delete the "glusterd_shared_storage" volume. With this fix gluster will do appropriate validation of enable-shared-storage option and it will not delete volume with "glusterd_shared_storage" name if it is a user created volume. Signed-off-by: Gaurav Kumar Garg <ggarg@redhat.com> >> Change-Id: I2bd92f938fb3de6ef496a934933bdcea9f251491 >> BUG: 1266818 >> Signed-off-by: Gaurav Kumar Garg <ggarg@redhat.com> >> Reviewed-on: http://review.gluster.org/12232 >> Reviewed-by: Atin Mukherjee <amukherj@redhat.com> >> Reviewed-by: Anand Nekkunti <anekkunt@redhat.com> >> Tested-by: NetBSD Build System <jenkins@build.gluster.org> >> Tested-by: Gluster Build System <jenkins@build.gluster.com> Change-Id: I8cb160fece702a730e25dadbc740e74efc57483e BUG: 1317425 Reviewed-on: http://review.gluster.org/13695 Tested-by: Gaurav Kumar Garg <ggarg@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-messages.h2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c28
2 files changed, 24 insertions, 6 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-messages.h b/xlators/mgmt/glusterd/src/glusterd-messages.h
index 9b3f5178bde..8dcbcdb2cd2 100644
--- a/xlators/mgmt/glusterd/src/glusterd-messages.h
+++ b/xlators/mgmt/glusterd/src/glusterd-messages.h
@@ -46,7 +46,7 @@
#define GLUSTERD_COMP_BASE GLFS_MSGID_GLUSTERD
-#define GLFS_NUM_MESSAGES 568
+#define GLFS_NUM_MESSAGES 573
#define GLFS_MSGID_END (GLUSTERD_COMP_BASE + GLFS_NUM_MESSAGES + 1)
/* Messaged with message IDs */
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 8c39c304366..437690faede 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -778,13 +778,19 @@ out:
static int
glusterd_validate_shared_storage (char *key, char *value, char *errstr)
{
- int32_t ret = -1;
- int32_t exists = -1;
- int32_t count = -1;
- xlator_t *this = NULL;
+ int32_t ret = -1;
+ int32_t exists = -1;
+ int32_t count = -1;
+ char *op = NULL;
+ xlator_t *this = NULL;
+ glusterd_conf_t *conf = NULL;
this = THIS;
GF_VALIDATE_OR_GOTO ("glusterd", this, out);
+
+ conf = this->private;
+ GF_VALIDATE_OR_GOTO (this->name, conf, out);
+
GF_VALIDATE_OR_GOTO (this->name, key, out);
GF_VALIDATE_OR_GOTO (this->name, value, out);
GF_VALIDATE_OR_GOTO (this->name, errstr, out);
@@ -806,7 +812,19 @@ glusterd_validate_shared_storage (char *key, char *value, char *errstr)
goto out;
}
- if (strcmp (value, "enable")) {
+ if (!strncmp (value, "disable", strlen ("disable"))) {
+ ret = dict_get_str (conf->opts, GLUSTERD_SHARED_STORAGE_KEY,
+ &op);
+ if (ret || !strncmp (op, "disable", strlen ("disable"))) {
+ snprintf (errstr, PATH_MAX, "Shared storage volume "
+ "does not exist. Please enable shared storage"
+ " for creating shared storage volume.");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SHARED_STORAGE_DOES_NOT_EXIST, "%s",
+ errstr);
+ ret = -1;
+ goto out;
+ }
goto out;
}