diff options
author | Martin Polden <mpolden@mpolden.no> | 2023-01-13 11:04:34 +0100 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2023-01-13 15:42:01 +0100 |
commit | eaac041f0b63b253cb345534370e0fd8d20c7d54 (patch) | |
tree | 400d6d048a0f7fc1df5b0ee3ce7d2c09dd83b39f /node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeAllocation.java | |
parent | 56f7ff45ceba9a4db0626b96e06c5ecb14d44ce9 (diff) |
Move parent-child cache to NodeList
Diffstat (limited to 'node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeAllocation.java')
-rw-r--r-- | node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeAllocation.java | 15 |
1 files changed, 7 insertions, 8 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 63d5db09380..bf3ad5f15fb 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 @@ -14,7 +14,6 @@ import com.yahoo.vespa.flags.PermanentFlags; import com.yahoo.vespa.hosted.provision.Node; import com.yahoo.vespa.hosted.provision.NodeList; import com.yahoo.vespa.hosted.provision.NodeRepository; -import com.yahoo.vespa.hosted.provision.NodesAndHosts; import com.yahoo.vespa.hosted.provision.node.Agent; import com.yahoo.vespa.hosted.provision.node.Allocation; @@ -43,7 +42,7 @@ class NodeAllocation { private static final Logger LOG = Logger.getLogger(NodeAllocation.class.getName()); /** List of all nodes in node-repository */ - private final NodesAndHosts<? extends NodeList> allNodesAndHosts; + private final NodeList allNodes; /** The application this list is for */ private final ApplicationId application; @@ -86,9 +85,9 @@ class NodeAllocation { private List<NodeCandidate> lastOffered; - NodeAllocation(NodesAndHosts<? extends NodeList> allNodesAndHosts, ApplicationId application, ClusterSpec cluster, NodeSpec requestedNodes, + NodeAllocation(NodeList allNodes, ApplicationId application, ClusterSpec cluster, NodeSpec requestedNodes, Supplier<Integer> nextIndex, NodeRepository nodeRepository) { - this.allNodesAndHosts = allNodesAndHosts; + this.allNodes = allNodes; this.application = application; this.cluster = cluster; this.requestedNodes = requestedNodes; @@ -214,7 +213,7 @@ class NodeAllocation { // In zones with shared hosts 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 : allNodesAndHosts.childrenOf(candidate.parentHostname().get())) { + for (Node nodeOnHost : allNodes.childrenOf(candidate.parentHostname().get())) { if (nodeOnHost.allocation().isEmpty()) continue; if (requestedNodes.isExclusive() || nodeOnHost.allocation().get().membership().cluster().isExclusive()) { if ( ! nodeOnHost.allocation().get().owner().equals(application)) return true; @@ -289,7 +288,7 @@ class NodeAllocation { } private Node resize(Node node) { - NodeResources hostResources = allNodesAndHosts.parentOf(node).get().flavor().resources(); + NodeResources hostResources = allNodes.parentOf(node).get().flavor().resources(); return node.with(new Flavor(requestedNodes.resources().get() .with(hostResources.diskSpeed()) .with(hostResources.storageType()) @@ -341,7 +340,7 @@ class NodeAllocation { if (hostType == NodeType.host) return nodeRepository.database().readProvisionIndices(count); // Infrastructure hosts have fixed indices, starting at 1 - Set<Integer> currentIndices = allNodesAndHosts.nodes().nodeType(hostType) + Set<Integer> currentIndices = allNodes.nodeType(hostType) .hostnames() .stream() // TODO(mpolden): Use cluster index instead of parsing hostname, once all @@ -441,7 +440,7 @@ class NodeAllocation { if (nodeType() == NodeType.tenant) return accepted; // Infrastructure nodes are always allocated by type. Count all nodes as accepted so that we never exceed // the wanted number of nodes for the type. - return allNodesAndHosts.nodes().nodeType(nodeType()).size(); + return allNodes.nodeType(nodeType()).size(); } /** Prefer to retire nodes we want the least */ |