summaryrefslogtreecommitdiffstats
path: root/node-repository/src/main/java
diff options
context:
space:
mode:
authorValerij Fredriksen <valerijf@verizonmedia.com>2020-10-30 11:18:38 +0100
committerValerij Fredriksen <valerijf@verizonmedia.com>2020-10-30 11:18:38 +0100
commit19f2da260e683342c21f7a5cb3327ebded9bd17b (patch)
tree108de6032cceacfa04111b9f6aaaa3cf3116ad54 /node-repository/src/main/java
parent3db4dc08df8be6044d78373fd8d60fe3bf829bcc (diff)
Force migration on exclusivity violation in dynamically provisioned zones
Diffstat (limited to 'node-repository/src/main/java')
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeAllocation.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeAllocation.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeAllocation.java
index cb04ae578de..68e11c4c995 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeAllocation.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeAllocation.java
@@ -180,9 +180,16 @@ class NodeAllocation {
private boolean violatesExclusivity(NodeCandidate candidate) {
if (candidate.parentHostname().isEmpty()) return false;
+
+ // In dynamic provisioned zones a node requiring exclusivity must be on a host that has exclusiveTo equal to its owner
+ if (nodeRepository.zone().getCloud().dynamicProvisioning())
+ return requestedNodes.isExclusive() &&
+ ! candidate.parent.flatMap(Node::exclusiveTo).map(application::equals).orElse(false);
+
+ // In non-dynamic provisioned zones we require that if either of the nodes on the host requires exclusivity,
+ // then all the nodes on the host must have the same owner
for (Node nodeOnHost : allNodes.childrenOf(candidate.parentHostname().get())) {
if (nodeOnHost.allocation().isEmpty()) continue;
- // If either this node or the other node on this host require exclusivity, they must have the same owner
if (requestedNodes.isExclusive() || nodeOnHost.allocation().get().membership().cluster().isExclusive()) {
if ( ! nodeOnHost.allocation().get().owner().equals(application)) return true;
}
@@ -367,7 +374,7 @@ class NodeAllocation {
/** Prefer to unretire nodes we don't want to retire, and otherwise those with lower index */
private List<NodeCandidate> byUnretiringPriority(Collection<NodeCandidate> candidates) {
return candidates.stream()
- .sorted(Comparator.comparing((NodeCandidate n) -> n.wantToRetire())
+ .sorted(Comparator.comparing(NodeCandidate::wantToRetire)
.thenComparing(n -> n.allocation().get().membership().index()))
.collect(Collectors.toList());
}
@@ -384,7 +391,7 @@ class NodeAllocation {
reasons.add("insufficient real resources on hosts");
if (reasons.isEmpty()) return "";
- return ": Not enough nodes available due to " + reasons.stream().collect(Collectors.joining(", "));
+ return ": Not enough nodes available due to " + String.join(", ", reasons);
}
static class FlavorCount {