From 0c25bc06dbb3ee121df5ed8ef2d9a0343e8919b6 Mon Sep 17 00:00:00 2001 From: Jon Bratseth Date: Wed, 3 Feb 2021 19:37:51 +0100 Subject: Increase to min only when it is within limits --- .../vespa/hosted/provision/autoscale/AllocationOptimizer.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'node-repository') 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()))); } } -- cgit v1.2.3