summaryrefslogtreecommitdiff
path: root/util/throttle.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/throttle.c')
-rw-r--r--util/throttle.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/util/throttle.c b/util/throttle.c
index 71246b2343..3817d9b904 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 ||
@@ -340,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;