summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@verizonmedia.com>2020-04-03 15:42:17 +0200
committerJon Bratseth <bratseth@verizonmedia.com>2020-04-03 15:42:17 +0200
commitc71a0d31e17889623a939e06cf729b8efa6bec42 (patch)
tree726fdde0cf52044cc35d1a9cc0c961c3a504f9eb
parent284f64dfa79a20718994faf5a0b910a4392f448b (diff)
Validate min and max
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/NodesSpecification.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/NodesSpecification.java b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/NodesSpecification.java
index 6a52ff4f051..6a2a8b218a0 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/NodesSpecification.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/NodesSpecification.java
@@ -60,6 +60,13 @@ public class NodesSpecification {
boolean required, boolean canFail, boolean exclusive,
Optional<String> dockerImageRepo,
Optional<String> combinedId) {
+ if (max.smallerThan(min))
+ throw new IllegalArgumentException("Min resources must be larger or equal to max resources, but " +
+ max + " is smaller than " + min);
+ if ( ! min.nodeResources().justNonNumbers().equals(max.nodeResources().justNonNumbers()))
+ throw new IllegalArgumentException("Min and max resources must have the same non-numeric settings, but " +
+ "min is " + min + " and max " + max);
+
this.min = min;
this.max = max;
this.dedicated = dedicated;