summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-volume-set.c
diff options
context:
space:
mode:
authorSheetal Pamecha <sheetal.pamecha08@gmail.com>2018-11-19 22:15:25 +0530
committerAmar Tumballi <amarts@redhat.com>2019-06-03 02:59:17 +0000
commit950726dfc8e3171bef625b563c0c6dbba1ec2928 (patch)
tree9f29ddeaa3d93984ffcc0f6620779e0ee8418512 /xlators/mgmt/glusterd/src/glusterd-volume-set.c
parent6fd8281ac9af58609979f660ece58c2ed1100e72 (diff)
posix: add storage.reserve-size option
storage.reserve-size option will take size as input instead of percentage. If set, priority will be given to storage.reserve-size over storage.reserve. Default value of this option is 0. fixes: bz#1651445 Change-Id: I7a7342c68e436e8bf65bd39c567512ee04abbcea Signed-off-by: Sheetal Pamecha <sheetal.pamecha08@gmail.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-volume-set.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-set.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
index 73cea5d5478..abc1573f372 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
@@ -750,6 +750,30 @@ out:
return ret;
}
+static int
+validate_size(glusterd_volinfo_t *volinfo, dict_t *dict, char *key, char *value,
+ char **op_errstr)
+{
+ xlator_t *this = NULL;
+ uint64_t size = 0;
+ int ret = -1;
+
+ this = THIS;
+ GF_VALIDATE_OR_GOTO("glusterd", this, out);
+ ret = gf_string2bytesize_uint64(value, &size);
+ if (ret < 0) {
+ gf_asprintf(op_errstr,
+ "%s is not a valid size. %s "
+ "expects a valid value in bytes",
+ 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;
+}
/* dispatch table for VOLUME SET
* -----------------------------
@@ -2346,6 +2370,15 @@ struct volopt_map_entry glusterd_volopt_map[] = {
.op_version = GD_OP_VERSION_3_13_0,
},
{
+ .key = "storage.reserve-size",
+ .voltype = "storage/posix",
+ .value = "0",
+ .validate_fn = validate_size,
+ .description = "If set, priority will be given to "
+ "storage.reserve-size over storage.reserve",
+ .op_version = GD_OP_VERSION_7_0,
+ },
+ {
.option = "health-check-timeout",
.key = "storage.health-check-timeout",
.type = NO_DOC,