From 8860eabdee32f78d9a34273a340b8f74476bc9a0 Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Wed, 1 Jun 2016 17:40:31 -0700 Subject: throttle: refuse iops-size without iops-total/read/write In a similar vein to commit ee2bdc33c913b7d765baa5aa338c29fb30a05c9a ("throttle: refuse bps_max/iops_max without bps/iops") it is likely that the user made a configuration error if iops-size has been set but no iops limit has been set. Print an error message so the user can check their throttling configuration. They should either remove iops-size if they don't want any throttling or specify one of iops-total, iops-read, or iops-write. Signed-off-by: Stefan Hajnoczi Reviewed-by: Alberto Garcia Message-id: 1464828031-25601-1-git-send-email-stefanha@redhat.com --- util/throttle.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'util') diff --git a/util/throttle.c b/util/throttle.c index 71246b2343..654f95caf2 100644 --- a/util/throttle.c +++ b/util/throttle.c @@ -315,6 +315,14 @@ bool throttle_is_valid(ThrottleConfig *cfg, Error **errp) return false; } + if (cfg->op_size && + !cfg->buckets[THROTTLE_OPS_TOTAL].avg && + !cfg->buckets[THROTTLE_OPS_READ].avg && + !cfg->buckets[THROTTLE_OPS_WRITE].avg) { + error_setg(errp, "iops size requires an iops value to be set"); + return false; + } + for (i = 0; i < BUCKETS_COUNT; i++) { if (cfg->buckets[i].avg < 0 || cfg->buckets[i].max < 0 || -- cgit v1.2.3-55-g7522