diff options
author | Håkon Hallingstad <hakon@verizonmedia.com> | 2021-02-02 15:25:30 +0100 |
---|---|---|
committer | Håkon Hallingstad <hakon@verizonmedia.com> | 2021-02-02 15:25:30 +0100 |
commit | c69b60a774f7c4448cc4c6709f1fc736dfba5bb0 (patch) | |
tree | d7c33dde5a49aa38776f020aa6c950581b3ef79f /node-repository | |
parent | d2b40aa63fb94282177771b0949a5a83e82bfb85 (diff) |
Override OS version when requiring RHEL 8
Diffstat (limited to 'node-repository')
-rw-r--r-- | node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/GroupPreparer.java | 22 |
1 files changed, 15 insertions, 7 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 3d61dd39b31..53ba73e4d82 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 @@ -61,12 +61,17 @@ public class GroupPreparer { public List<Node> prepare(ApplicationId application, ClusterSpec cluster, NodeSpec requestedNodes, List<Node> surplusActiveNodes, MutableInteger highestIndex, int wantedGroups) { + String allocateOsRequirement = allocateOsRequirementFlag + .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. { MutableInteger probePrepareHighestIndex = new MutableInteger(highestIndex.get()); NodeAllocation probeAllocation = prepareAllocation(application, cluster, requestedNodes, surplusActiveNodes, - probePrepareHighestIndex, wantedGroups, PROBE_LOCK); + probePrepareHighestIndex, wantedGroups, PROBE_LOCK, + allocateOsRequirement); if (probeAllocation.fulfilledAndNoChanges()) { List<Node> acceptedNodes = probeAllocation.finalNodes(); surplusActiveNodes.removeAll(acceptedNodes); @@ -80,10 +85,16 @@ public class GroupPreparer { Mutex allocationLock = nodeRepository.lockUnallocated()) { NodeAllocation allocation = prepareAllocation(application, cluster, requestedNodes, surplusActiveNodes, - highestIndex, wantedGroups, allocationLock); + highestIndex, wantedGroups, allocationLock, allocateOsRequirement); if (nodeRepository.zone().getCloud().dynamicProvisioning()) { - Version osVersion = nodeRepository.osVersions().targetFor(NodeType.host).orElse(Version.emptyVersion); + final Version osVersion; + if (allocateOsRequirement.equals("rhel8")) { + osVersion = new Version(8); + } else { + osVersion = nodeRepository.osVersions().targetFor(NodeType.host).orElse(Version.emptyVersion); + } + List<ProvisionedHost> provisionedHosts = allocation.getFulfilledDockerDeficit() .map(deficit -> hostProvisioner.get().provisionHosts(nodeRepository.database().getProvisionIndexes(deficit.getCount()), deficit.getFlavor(), @@ -122,13 +133,10 @@ public class GroupPreparer { private NodeAllocation prepareAllocation(ApplicationId application, ClusterSpec cluster, NodeSpec requestedNodes, List<Node> surplusActiveNodes, MutableInteger highestIndex, int wantedGroups, - Mutex allocationLock) { + Mutex allocationLock, String allocateOsRequirement) { LockedNodeList allNodes = nodeRepository.list(allocationLock); NodeAllocation allocation = new NodeAllocation(allNodes, application, cluster, requestedNodes, highestIndex, nodeRepository); - String allocateOsRequirement = allocateOsRequirementFlag - .with(FetchVector.Dimension.APPLICATION_ID, application.serializedForm()) - .value(); NodePrioritizer prioritizer = new NodePrioritizer( allNodes, application, cluster, requestedNodes, wantedGroups, nodeRepository.zone().getCloud().dynamicProvisioning(), nodeRepository.nameResolver(), |