summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocationOptimizer.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocationOptimizer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocationOptimizer.java
index 03617eeefd8..7064a7d2e6a 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocationOptimizer.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocationOptimizer.java
@@ -114,9 +114,10 @@ public class AllocationOptimizer {
return nonScaled.withVcpu(cpu).withMemoryGb(memory).withDiskGb(disk);
}
- /** Returns a copy of the given limits where the minimum nodes are at least the given value */
- private Limits atLeast(int nodes, Limits limits) {
- return limits.withMin(limits.min().withNodes(Math.max(nodes, limits.min().nodes())));
+ /** Returns a copy of the given limits where the minimum nodes are at least the given value when allowed */
+ private Limits atLeast(int min, Limits limits) {
+ if (limits.max().nodes() < min) return limits; // not allowed
+ return limits.withMin(limits.min().withNodes(Math.max(min, limits.min().nodes())));
}
}