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