From 19f2da260e683342c21f7a5cb3327ebded9bd17b Mon Sep 17 00:00:00 2001 From: Valerij Fredriksen Date: Fri, 30 Oct 2020 11:18:38 +0100 Subject: Force migration on exclusivity violation in dynamically provisioned zones --- .../vespa/hosted/provision/provisioning/NodeAllocation.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'node-repository/src/main/java') 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 byUnretiringPriority(Collection 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 { -- cgit v1.2.3