diff options
author | Valerij Fredriksen <freva@users.noreply.github.com> | 2023-10-31 10:56:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-31 10:56:19 +0100 |
commit | b91b4a2c22bf3638c8dbf71edc59562f7426571a (patch) | |
tree | cef210f198bc04a3ac5cce2c69a94dbffb6f6335 | |
parent | c6fbd2a7a06236840296fc71280cdba5d19cbf00 (diff) | |
parent | dce286acc12f9a1567b0cbc3215aff90e6b4731f (diff) |
Merge pull request #29164 from vespa-engine/hakonhall/set-exclusiveto-on-parent-host-to-child-application
Set exclusiveTo on parent host to child application
-rw-r--r-- | node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Nodes.java | 12 | ||||
-rw-r--r-- | node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Preparer.java | 2 |
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(); |