summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodePrioritizer.java11
1 files changed, 8 insertions, 3 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 861e1062d66..5a3f0380fa2 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
@@ -16,6 +16,7 @@ import com.yahoo.vespa.hosted.provision.persistence.NameResolver;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -121,7 +122,7 @@ class NodePrioritizer {
* already have nodes allocated to this tenant
*/
void addNewDockerNodes(Mutex allocationLock, boolean exclusively) {
- NodeList candidates = allNodes;
+ NodeList candidates;
if (exclusively) {
Set<String> candidateHostnames = allNodes.asList().stream()
@@ -130,7 +131,12 @@ class NodePrioritizer {
.flatMap(node -> node.parentHostname().stream())
.collect(Collectors.toSet());
- candidates = candidates.filter(node -> candidateHostnames.contains(node.hostname()));
+ candidates = allNodes
+ .filter(node -> candidateHostnames.contains(node.hostname()))
+ .filter(node -> EnumSet.of(Node.State.provisioned, Node.State.ready, Node.State.active)
+ .contains(node.state()));
+ } else {
+ candidates = allNodes.state(Node.State.active);
}
addNewDockerNodesOn(allocationLock, candidates);
@@ -142,7 +148,6 @@ class NodePrioritizer {
for (Node node : candidates) {
if (node.type() != NodeType.host) continue;
- if (node.state() != Node.State.active) continue;
if (node.status().wantToRetire()) continue;
boolean hostHasCapacityForWantedFlavor = capacity.hasCapacity(node, wantedResourceCapacity);