From 17fcdf15aa8620bf69623bae4a081f5cf7780dbd Mon Sep 17 00:00:00 2001
From: Gaurav Yadav <gyadav@redhat.com>
Date: Tue, 21 Feb 2017 22:35:47 +0530
Subject: [PATCH 398/406] glusterd : cluster.brick-multiplex validation is
missing while setting it
Currently glusterd allow setting all values while setting cluster.brick-multiplex
option. Validation of allowed options is missing.
With this patch glusterd will validate the values given while setting
cluster.brick-multiplex.
> Reviewed-on: https://review.gluster.org/16704
> Smoke: Gluster Build System <jenkins@build.gluster.org>
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Change-Id: I938fb16b8f5faa9d31326373cd18632b8aa7ebab
BUG: 1443950
Signed-off-by: Gaurav Yadav <gyadav@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/104133
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
xlators/mgmt/glusterd/src/glusterd-volume-set.c | 31 ++++---------------------
1 file changed, 4 insertions(+), 27 deletions(-)
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
index 4ee27b4..2d4dfc0 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
@@ -893,30 +893,6 @@ out:
return ret;
}
-
-static int
-validate_worm (glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
- char *value, char **op_errstr)
-{
- xlator_t *this = NULL;
- gf_boolean_t b = _gf_false;
- int ret = -1;
-
- this = THIS;
- GF_VALIDATE_OR_GOTO ("glusterd", this, out);
- ret = gf_string2boolean (value, &b);
- if (ret) {
- gf_asprintf (op_errstr, "%s is not a valid boolean value. %s "
- "expects a valid boolean value.", value, key);
- gf_msg (this->name, GF_LOG_ERROR, 0,
- GD_MSG_INVALID_ENTRY, "%s", *op_errstr);
- }
-out:
- gf_msg_debug ("glusterd", 0, "Returning %d", ret);
-
- return ret;
-}
-
static int
validate_boolean (glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
char *value, char **op_errstr)
@@ -2500,7 +2476,7 @@ struct volopt_map_entry glusterd_volopt_map[] = {
.voltype = "features/worm",
.option = "worm",
.value = "off",
- .validate_fn = validate_worm,
+ .validate_fn = validate_boolean,
.op_version = 2,
.flags = OPT_FLAG_CLIENT_OPT | OPT_FLAG_XLATOR_OPT
},
@@ -2508,7 +2484,7 @@ struct volopt_map_entry glusterd_volopt_map[] = {
.voltype = "features/worm",
.option = "worm-file-level",
.value = "off",
- .validate_fn = validate_worm,
+ .validate_fn = validate_boolean,
.op_version = GD_OP_VERSION_3_8_0,
.flags = OPT_FLAG_CLIENT_OPT | OPT_FLAG_XLATOR_OPT
},
@@ -3145,7 +3121,8 @@ struct volopt_map_entry glusterd_volopt_map[] = {
{ .key = GLUSTERD_BRICK_MULTIPLEX_KEY,
.voltype = "mgmt/glusterd",
.value = "off",
- .op_version = GD_OP_VERSION_3_10_0
+ .op_version = GD_OP_VERSION_3_10_0,
+ .validate_fn = validate_boolean
},
{ .key = NULL
}
--
1.8.3.1