summaryrefslogtreecommitdiffstats
path: root/node-repository
diff options
context:
space:
mode:
authorjonmv <venstad@gmail.com>2024-02-28 09:05:44 +0100
committerjonmv <venstad@gmail.com>2024-02-28 09:05:44 +0100
commit37e96c23409cee652cca0ffec21f39950dd28d6e (patch)
tree86fa97f8eb3b203436dcfdc0eb33a6d1a3ae507c /node-repository
parent5c30c710f78047d565a24eca5683ce2fae18d3da (diff)
Random simplification in nodes check
Diffstat (limited to 'node-repository')
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Activator.java16
1 files changed, 4 insertions, 12 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Activator.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Activator.java
index 9bf7d928138..2ebc2350542 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Activator.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Activator.java
@@ -20,7 +20,6 @@ import com.yahoo.vespa.hosted.provision.node.Allocation;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -77,11 +76,11 @@ class Activator {
NodeList oldActive = applicationNodes.state(Node.State.active); // All nodes active now
NodeList continuedActive = oldActive.matching(node -> hostnames.contains(node.hostname()));
NodeList newActive = withHostInfo(continuedActive, hosts, activationTime).and(reserved); // All nodes that will be active when this is committed
- if ( ! containsAll(hostnames, newActive))
+ if ( ! newActive.hostnames().containsAll(hostnames))
throw new RuntimeException("Activation of " + application + " failed, could not find all requested hosts." +
- "\nRequested: " + hosts +
- "\nReserved: " + reserved.hostnames() +
- "\nActive: " + oldActive.hostnames());
+ "\nRequested: " + hosts +
+ "\nReserved: " + reserved.hostnames() +
+ "\nActive: " + oldActive.hostnames());
validateParentHosts(application, allNodes, reserved);
@@ -195,13 +194,6 @@ class Activator {
}
}
- private boolean containsAll(Set<String> hosts, NodeList nodes) {
- Set<String> notFoundHosts = new HashSet<>(hosts);
- for (Node node : nodes)
- notFoundHosts.remove(node.hostname());
- return notFoundHosts.isEmpty();
- }
-
/** Returns the input nodes with the changes resulting from applying the settings in hosts to the given list of nodes. */
private NodeList withHostInfo(NodeList nodes, Collection<HostSpec> hosts, Instant at) {
List<Node> updated = new ArrayList<>();