From d9b01ba3e0ef6507bfa373a4d8a70131647e31f0 Mon Sep 17 00:00:00 2001 From: Jon Bratseth Date: Thu, 5 Nov 2020 08:57:33 +0100 Subject: Non-functional changes --- .../hosted/provision/provisioning/NodePrioritizer.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'node-repository/src') 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); } /** -- cgit v1.2.3