diff options
author | Jon Bratseth <bratseth@gmail.com> | 2020-11-05 08:57:33 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2020-11-05 08:57:33 +0100 |
commit | d9b01ba3e0ef6507bfa373a4d8a70131647e31f0 (patch) | |
tree | 532f7df45e258d22b5be9a14a712d8f29c7801dc /node-repository | |
parent | 95ca6fdcb45b1d3ae805c5c9f3d20cc7972f136d (diff) |
Non-functional changes
Diffstat (limited to 'node-repository')
-rw-r--r-- | node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodePrioritizer.java | 14 |
1 files changed, 7 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..4b875d68780 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,7 +127,7 @@ 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) { @@ -193,9 +192,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); } /** |