aboutsummaryrefslogtreecommitdiffstats
path: root/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/GroupPreparer.java
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2021-05-26 17:36:43 +0200
committerJon Bratseth <bratseth@gmail.com>2021-05-26 17:36:43 +0200
commit65a6e1ec48a7c36c5b5d40d3f37ad241fdfff878 (patch)
tree57909160c0e799d9b38d0ed2ed91048ab5ae4cd7 /node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/GroupPreparer.java
parent4f3e0fcd908e61f7e5ef9ff37b2e3bb5f0cdc70b (diff)
Show info on nearest flavor also with autoscaling
Diffstat (limited to 'node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/GroupPreparer.java')
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/GroupPreparer.java54
1 files changed, 30 insertions, 24 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/GroupPreparer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/GroupPreparer.java
index 81a56e4d47e..def992a264b 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/GroupPreparer.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/GroupPreparer.java
@@ -62,8 +62,8 @@ public class GroupPreparer {
List<Node> surplusActiveNodes, NodeIndices indices, int wantedGroups) {
String allocateOsRequirement = allocateOsRequirementFlag
- .with(FetchVector.Dimension.APPLICATION_ID, application.serializedForm())
- .value();
+ .with(FetchVector.Dimension.APPLICATION_ID, application.serializedForm())
+ .value();
// Try preparing in memory without global unallocated lock. Most of the time there should be no changes and we
// can return nodes previously allocated.
@@ -89,24 +89,16 @@ public class GroupPreparer {
allocateOsRequirement);
NodeType hostType = allocation.nodeType().hostType();
if (canProvisionDynamically(hostType)) {
- final Version osVersion;
- if (allocateOsRequirement.equals("rhel8")) {
- osVersion = new Version(8, Integer.MAX_VALUE /* always use latest 8 version */, 0);
- } else if (allocateOsRequirement.equals("rhel7")) {
- osVersion = new Version(7, Integer.MAX_VALUE /* always use latest 7 version */, 0);
- } else {
- osVersion = nodeRepository.osVersions().targetFor(hostType).orElse(Version.emptyVersion);
- }
HostSharing sharing = hostSharing(requestedNodes, hostType);
List<ProvisionedHost> provisionedHosts = allocation.hostDeficit()
- .map(deficit -> {
- return hostProvisioner.get().provisionHosts(allocation.provisionIndices(deficit.count()),
- hostType,
- deficit.resources(),
- application,
- osVersion,
- sharing);
- })
+ .map(deficit ->
+ hostProvisioner.get().provisionHosts(allocation.provisionIndices(deficit.count()),
+ hostType,
+ deficit.resources(),
+ application,
+ decideOsVersion(allocateOsRequirement, hostType),
+ sharing)
+ )
.orElseGet(List::of);
// At this point we have started provisioning of the hosts, the first priority is to make sure that
@@ -141,12 +133,17 @@ public class GroupPreparer {
List<Node> surplusActiveNodes, Supplier<Integer> nextIndex, int wantedGroups,
Mutex allocationLock, String allocateOsRequirement) {
LockedNodeList allNodes = nodeRepository.nodes().list(allocationLock);
- NodeAllocation allocation = new NodeAllocation(allNodes, application, cluster, requestedNodes,
- nextIndex, nodeRepository);
- NodePrioritizer prioritizer = new NodePrioritizer(
- allNodes, application, cluster, requestedNodes, wantedGroups,
- nodeRepository.zone().getCloud().dynamicProvisioning(), nodeRepository.nameResolver(),
- nodeRepository.resourcesCalculator(), nodeRepository.spareCount(), allocateOsRequirement);
+ NodeAllocation allocation = new NodeAllocation(allNodes, application, cluster, requestedNodes, nextIndex, nodeRepository);
+ NodePrioritizer prioritizer = new NodePrioritizer(allNodes,
+ application,
+ cluster,
+ requestedNodes,
+ wantedGroups,
+ nodeRepository.zone().getCloud().dynamicProvisioning(),
+ nodeRepository.nameResolver(),
+ nodeRepository.resourcesCalculator(),
+ nodeRepository.spareCount(),
+ allocateOsRequirement);
allocation.offer(prioritizer.collect(surplusActiveNodes));
return allocation;
}
@@ -164,4 +161,13 @@ public class GroupPreparer {
return sharing;
}
+ private Version decideOsVersion(String allocateOsRequirement, NodeType hostType) {
+ if (allocateOsRequirement.equals("rhel8"))
+ return new Version(8, Integer.MAX_VALUE /* always use latest 8 version */, 0);
+ else if (allocateOsRequirement.equals("rhel7"))
+ return new Version(7, Integer.MAX_VALUE /* always use latest 7 version */, 0);
+ else
+ return nodeRepository.osVersions().targetFor(hostType).orElse(Version.emptyVersion);
+ }
+
}