diff options
author | Jon Bratseth <bratseth@gmail.com> | 2021-02-03 19:37:51 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2021-02-03 19:37:51 +0100 |
commit | 0c25bc06dbb3ee121df5ed8ef2d9a0343e8919b6 (patch) | |
tree | dec999d763514f2ea381604444c9b0d816e03a5e /node-repository | |
parent | fcb4c2aa12eae4befe7ba9d11aeabbef6d889015 (diff) |
Increase to min only when it is within limits
Diffstat (limited to 'node-repository')
-rw-r--r-- | node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocationOptimizer.java | 7 |
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()))); } } |