diff options
author | Jon Bratseth <bratseth@oath.com> | 2020-11-05 09:02:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-05 09:02:52 +0100 |
commit | aeb457fa416c242601c6036ad3a3282df2b719fe (patch) | |
tree | 357a9c1b52d472241dca8a99a5f1c65647df355a | |
parent | 5ac341e29391218e70b4af6c0d2a279df4cd4940 (diff) | |
parent | 31752d614bcadcf7bfaf4e6becf2804ad24ba945 (diff) |
Merge pull request #15184 from vespa-engine/bratseth/no-testers-on-reserved-nodes
Bratseth/no testers on reserved nodes
-rw-r--r-- | node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodePrioritizer.java | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodePrioritizer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodePrioritizer.java index 4f5b2fd086e..abfd5e021c4 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodePrioritizer.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodePrioritizer.java @@ -74,11 +74,10 @@ public class NodePrioritizer { // In dynamically provisioned zones, we can always take spare hosts since we can provision new on-demand, // NodeCandidate::compareTo will ensure that they will not be used until there is no room elsewhere. // In non-dynamically provisioned zones, we only allow allocating to spare hosts to replace failed nodes. - this.canAllocateToSpareHosts = dynamicProvisioning || - isReplacement(nodesInCluster.size(), nodesInCluster.state(Node.State.failed).size()); + this.canAllocateToSpareHosts = dynamicProvisioning || isReplacement(nodesInCluster); // Do not allocate new nodes for exclusive deployments in dynamically provisioned zones: provision new host instead. this.canAllocateNew = requestedNodes instanceof NodeSpec.CountNodeSpec - && (!dynamicProvisioning || !requestedNodes.isExclusive()); + && (!dynamicProvisioning || !requestedNodes.isExclusive()); } /** Collects all node candidates for this application and returns them in the most-to-least preferred order */ @@ -86,7 +85,7 @@ public class NodePrioritizer { addApplicationNodes(); addSurplusNodes(surplusActiveNodes); addReadyNodes(); - addNewNodes(); + addCandidatesOnExistingHosts(); return prioritize(); } @@ -128,12 +127,13 @@ public class NodePrioritizer { } /** Add a node on each host with enough capacity for the requested flavor */ - private void addNewNodes() { + private void addCandidatesOnExistingHosts() { if ( !canAllocateNew) return; for (Node host : allNodes) { if ( ! nodeRepository.canAllocateTenantNodeTo(host)) continue; if (host.reservedTo().isPresent() && !host.reservedTo().get().equals(application.tenant())) continue; + if (host.reservedTo().isPresent() && application.instance().isTester()) continue; if (host.exclusiveTo().isPresent()) continue; // Never allocate new nodes to exclusive hosts if ( spareHosts.contains(host) && !canAllocateToSpareHosts) continue; if ( ! capacity.hasCapacity(host, requestedNodes.resources().get())) continue; @@ -193,9 +193,10 @@ public class NodePrioritizer { } /** Returns whether we are allocating to replace a failed node */ - private boolean isReplacement(int nodesInCluster, int failedNodesInCluster) { + private boolean isReplacement(NodeList nodesInCluster) { + int failedNodesInCluster = nodesInCluster.state(Node.State.failed).size(); if (failedNodesInCluster == 0) return false; - return ! requestedNodes.fulfilledBy(nodesInCluster - failedNodesInCluster); + return ! requestedNodes.fulfilledBy(nodesInCluster.size() - failedNodesInCluster); } /** |