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()));

        try {
            loadBalancerProvisioner.ifPresent(provisioner -> provisioner.prepare(application, cluster, requested));
        } catch (RuntimeException e) {
            if (!requested.canFail())
                log.warning("Failed to prepare load balancers for " + application + " " + cluster + ": " + Exceptions.toMessageString(e) + " (Ignoring because bootstrap deployment)");
            throw e;
        }

        // 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.fulfilledWithoutChanges()) {
            List<Node> acceptedNodes = probeAllocation.finalNodes();
            indices.commitProbe();
            return acceptedNodes;
        } else {
            // There were some changes, so re-do the allocation with locks
            indices.resetProbe();
            return prepareWithLocks(application, cluster, requested, indices);
        }
    }
Ensure sufficient nodes are reserved or active for the given application, group and cluster

@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
@return the list of nodes this cluster group will have allocated if activated
node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Preparer.java