aboutsummaryrefslogtreecommitdiffstats
path: root/node-repository
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@vespa.ai>2023-07-12 10:46:32 +0200
committerJon Bratseth <bratseth@vespa.ai>2023-07-12 10:46:32 +0200
commit393487787afc13a88067d0e0e07711b7587b7bfe (patch)
tree455cf16c02af130028ee3bba67b4f17ec2889248 /node-repository
parent20a4805e4289db5914a7d846467e5b8c5f55f122 (diff)
Simplify
Diffstat (limited to 'node-repository')
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Preparer.java33
1 files changed, 11 insertions, 22 deletions
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 0617eaff9d9..6dab216e911 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
@@ -29,35 +29,24 @@ class Preparer {
this.groupPreparer = new GroupPreparer(nodeRepository, hostProvisioner);
}
- /** Prepare all required resources for the given application and cluster */
+ /**
+ * 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) {
try {
- var nodes = prepareNodes(application, cluster, requested);
- prepareLoadBalancer(application, cluster, requested);
+ var nodes = groupPreparer.prepare(application, cluster, requested, groupPreparer.createUnlockedNodeList());
+ loadBalancerProvisioner.ifPresent(provisioner -> provisioner.prepare(application, cluster, requested));
return nodes;
}
catch (NodeAllocationException e) {
- throw new NodeAllocationException("Could not satisfy " + requested +
- " in " + application + " " + cluster, e,
+ throw new NodeAllocationException("Could not satisfy " + requested + " in " + application + " " + cluster, e,
e.retryable());
}
}
- /**
- * Ensure sufficient nodes are reserved or active for the given application and cluster
- *
- * @return the list of nodes this cluster 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
- private List<Node> prepareNodes(ApplicationId application, ClusterSpec cluster, NodeSpec requested) {
- return groupPreparer.prepare(application, cluster, requested, groupPreparer.createUnlockedNodeList());
- }
-
- /** Prepare a load balancer for given application and cluster */
- public void prepareLoadBalancer(ApplicationId application, ClusterSpec cluster, NodeSpec requested) {
- loadBalancerProvisioner.ifPresent(provisioner -> provisioner.prepare(application, cluster, requested));
- }
-
}