From 8c87a8a1ec685c4b89a1a5565ab35b06d770580e Mon Sep 17 00:00:00 2001 From: hari gowtham Date: Thu, 4 May 2017 15:49:59 +0530 Subject: [PATCH 423/426] Tier: Watermark check for hi and low value being equal Problem: Both low and hi watermark can be set to same value as the check missed the case for being equal. Fix: Add the check to both the hi and low values being equal along with the low value being higher than hi value. >Change-Id: Ia235163aeefdcb2a059e2e58a5cfd8fb7f1a4c64 >BUG: 1447960 >Signed-off-by: hari gowtham >Reviewed-on: https://review.gluster.org/17175 >Smoke: Gluster Build System >Tested-by: hari gowtham >Reviewed-by: Atin Mukherjee >Reviewed-by: Milind Changire >NetBSD-regression: NetBSD Build System >CentOS-regression: Gluster Build System >Signed-off-by: hari gowtham Change-Id: Ia235163aeefdcb2a059e2e58a5cfd8fb7f1a4c64 BUG: 1447929 Signed-off-by: hari gowtham Reviewed-on: https://code.engineering.redhat.com/gerrit/105658 Reviewed-by: Atin Mukherjee --- tests/basic/tier/tier.t | 1 + xlators/mgmt/glusterd/src/glusterd-volume-set.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/basic/tier/tier.t b/tests/basic/tier/tier.t index 75b834d..9084afd 100755 --- a/tests/basic/tier/tier.t +++ b/tests/basic/tier/tier.t @@ -110,6 +110,7 @@ TEST $CLI volume set $V0 cluster.tier-max-files 1000 TEST $CLI volume set $V0 cluster.tier-max-promote-file-size 1000 TEST ! $CLI volume set $V0 cluster.tier-max-files -3 TEST ! $CLI volume set $V0 cluster.watermark-low 90 +TEST ! $CLI volume set $V0 cluster.watermark-hi 75 TEST ! $CLI volume set $V0 cluster.read-freq-threshold -12 TEST ! $CLI volume set $V0 cluster.write-freq-threshold -12 diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c index 30338dc..ce827e5 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c @@ -441,9 +441,10 @@ validate_tier (glusterd_volinfo_t *volinfo, dict_t *dict, char *key, gf_string2bytesize_uint64 (current_wm_low, &wm_low); } - if (wm_low > wm_hi) { + if (wm_low >= wm_hi) { snprintf (errstr, sizeof (errstr), "lower watermark" - " cannot exceed upper watermark."); + " cannot be equal or exceed upper " + "watermark."); gf_msg (this->name, GF_LOG_ERROR, EINVAL, GD_MSG_INCOMPATIBLE_VALUE, "%s", errstr); *op_errstr = gf_strdup (errstr); -- 1.8.3.1