aboutsummaryrefslogtreecommitdiffstats
path: root/node-repository
diff options
context:
space:
mode:
authorHåkon Hallingstad <hakon@yahooinc.com>2023-10-31 10:31:17 +0100
committerHåkon Hallingstad <hakon@yahooinc.com>2023-10-31 10:31:17 +0100
commitdce286acc12f9a1567b0cbc3215aff90e6b4731f (patch)
tree0923361c2f66c35c81c698046ae330be45375692 /node-repository
parent621520610face5ad70122a4ddecb61e2222798d8 (diff)
Set exclusiveTo on parent host to child application
Diffstat (limited to 'node-repository')
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Nodes.java12
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Preparer.java2
2 files changed, 7 insertions, 7 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Nodes.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Nodes.java
index 5c0614dd8d6..9a4e47ed154 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Nodes.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Nodes.java
@@ -224,19 +224,19 @@ public class Nodes {
performOn(nodes, (node, mutex) -> write(node.with(node.allocation().get().removable(true, reusable)), mutex));
}
- /** Sets the exclusiveToApplicationId field. The nodes must be tenant hosts without the field already. */
- public void setExclusiveToApplicationId(List<Node> hosts, ApplicationMutex lock) {
+ /** Sets the exclusiveToApplicationId field of the hosts to 'application'. */
+ public void setExclusiveToApplicationId(List<Node> hosts, ApplicationMutex lock, ApplicationId application) {
List<Node> hostsToWrite = hosts.stream()
- .filter(host -> !host.exclusiveToApplicationId().equals(Optional.of(lock.application())))
+ .filter(host -> !host.exclusiveToApplicationId().equals(Optional.of(application)))
.peek(host -> {
if (host.type() != NodeType.host)
- throw new IllegalArgumentException("Unable to set " + host + " exclusive to " + lock.application() +
+ throw new IllegalArgumentException("Unable to set " + host + " exclusive to " + application +
": the node is not a tenant host");
if (host.exclusiveToApplicationId().isPresent())
- throw new IllegalArgumentException("Unable to set " + host + " exclusive to " + lock.application() +
+ throw new IllegalArgumentException("Unable to set " + host + " exclusive to " + application +
": it is already set exclusive to " + host.exclusiveToApplicationId().get());
})
- .map(host -> host.withExclusiveToApplicationId(lock.application()))
+ .map(host -> host.withExclusiveToApplicationId(application))
.toList();
write(hostsToWrite, lock);
}
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Preparer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Preparer.java
index 83afe92d025..978a69978b8 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Preparer.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Preparer.java
@@ -174,7 +174,7 @@ public class Preparer {
// Carry out and return allocation
if (parentLockOrNull != null) {
List<Node> exclusiveParents = allocation.parentsRequiredToBeExclusive();
- nodeRepository.nodes().setExclusiveToApplicationId(exclusiveParents, parentLockOrNull);
+ nodeRepository.nodes().setExclusiveToApplicationId(exclusiveParents, parentLockOrNull, application);
// TODO: also update tags
}
acceptedNodes = allocation.finalNodes();