From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47105) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bVbN5-0003As-Tk for qemu-devel@nongnu.org; Fri, 05 Aug 2016 05:24:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bVbN3-0000Ny-Pi for qemu-devel@nongnu.org; Fri, 05 Aug 2016 05:24:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48168) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bVbN3-0000Ns-JW for qemu-devel@nongnu.org; Fri, 05 Aug 2016 05:24:49 -0400 From: Stefan Hajnoczi Date: Fri, 5 Aug 2016 10:24:39 +0100 Message-Id: <1470389082-15298-3-git-send-email-stefanha@redhat.com> In-Reply-To: <1470389082-15298-1-git-send-email-stefanha@redhat.com> References: <1470389082-15298-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PULL for-2.7 2/5] throttle: Don't allow burst limits to be lower than the normal limits List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Alberto Garcia , Stefan Hajnoczi From: Alberto Garcia Setting FOO_max to a value that is lower than FOO does not make sense, and it produces odd results depending on the value of FOO_max_length. Although the user should not set that configuration in the first place it's better to reject it explicitly. https://bugzilla.redhat.com/show_bug.cgi?id=1355665 Signed-off-by: Alberto Garcia Reported-by: Gu Nini Reviewed-by: Eric Blake Message-id: 663d5aca406060e31f80d8113f77b6feee63b919.1469693110.git.berto@igalia.com Signed-off-by: Stefan Hajnoczi --- util/throttle.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/util/throttle.c b/util/throttle.c index 654f95c..3817d9b 100644 --- a/util/throttle.c +++ b/util/throttle.c @@ -348,6 +348,11 @@ bool throttle_is_valid(ThrottleConfig *cfg, Error **errp) " bps/iops values"); return false; } + + if (cfg->buckets[i].max && cfg->buckets[i].max < cfg->buckets[i].avg) { + error_setg(errp, "bps_max/iops_max cannot be lower than bps/iops"); + return false; + } } return true; -- 2.7.4