summaryrefslogtreecommitdiffstats
path: root/node-repository
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@vespa.ai>2023-07-12 11:26:22 +0200
committerJon Bratseth <bratseth@vespa.ai>2023-07-12 11:26:22 +0200
commit4cbdf56d3cfa8e8c828d1a0b658d959870515a1d (patch)
treed343a8cd80696888b4172ac119f990ba28587db6 /node-repository
parent63dc331187f9d0f2a3570552edaff2c6e3536bcf (diff)
Simplify
Diffstat (limited to 'node-repository')
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/GroupPreparer.java7
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Preparer.java10
2 files changed, 3 insertions, 14 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 ff24175f2a0..e3e1f265f4c 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
@@ -49,13 +49,12 @@ public class GroupPreparer {
* @param application the application we are allocating to
* @param cluster the cluster and group we are allocating to
* @param requested a specification of the requested nodes
- * @param allNodes list of all nodes and hosts
* @return the list of nodes this cluster group will have allocated if activated
*/
// Note: This operation may make persisted changes to the set of reserved and inactive nodes,
// but it may not change the set of active nodes, as the active nodes must stay in sync with the
// active config model which is changed on activate
- public List<Node> prepare(ApplicationId application, ClusterSpec cluster, NodeSpec requested, LockedNodeList allNodes) {
+ public List<Node> prepare(ApplicationId application, ClusterSpec cluster, NodeSpec requested) {
log.log(Level.FINE, () -> "Preparing " + cluster.type().name() + " " + cluster.id() + " with requested resources " +
requested.resources().orElse(NodeResources.unspecified()));
@@ -63,6 +62,7 @@ public class GroupPreparer {
// Try preparing in memory without global unallocated lock. Most of the time there should be no changes,
// and we can return nodes previously allocated.
+ LockedNodeList allNodes = nodeRepository.nodes().list(PROBE_LOCK);
NodeIndices indices = new NodeIndices(cluster.id(), allNodes);
NodeAllocation probeAllocation = prepareAllocation(application, cluster, requested, indices::probeNext, allNodes);
if (probeAllocation.fulfilledAndNoChanges()) {
@@ -76,9 +76,6 @@ public class GroupPreparer {
}
}
- // Use this to create allNodes param to prepare method for first invocation of prepare
- LockedNodeList createUnlockedNodeList() { return nodeRepository.nodes().list(PROBE_LOCK); }
-
/// Note that this will write to the node repo.
private List<Node> prepareWithLocks(ApplicationId application, ClusterSpec cluster, NodeSpec requested, NodeIndices indices) {
try (Mutex lock = nodeRepository.applications().lock(application);
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Preparer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Preparer.java
index 5a33f2f2bb9..1002f428b06 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Preparer.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Preparer.java
@@ -27,16 +27,8 @@ class Preparer {
this.groupPreparer = new GroupPreparer(nodeRepository, hostProvisioner, loadBalancerProvisioner);
}
- /**
- * Prepare all required resources for the given application and cluster.
- *
- * @return the list of nodes this cluster will have allocated if activated
- */
- // Note: This may make persisted changes to the set of reserved and inactive nodes,
- // but it may not change the set of active nodes, as the active nodes must stay in sync with the
- // active config model which is changed on activate
public List<Node> prepare(ApplicationId application, ClusterSpec cluster, NodeSpec requested) {
- return groupPreparer.prepare(application, cluster, requested, groupPreparer.createUnlockedNodeList());
+ return groupPreparer.prepare(application, cluster, requested);
}
}