@Override
    public List<HostSpec> prepare(ApplicationId application, ClusterSpec cluster, Capacity requested, ProvisionLogger logger) {
        log.log(Level.FINE, "Received deploy prepare request for " + requested +
                            " for application " + application + ", cluster " + cluster);
        validate(application, cluster, requested, logger);

        var capacityPolicies = nodeRepository.capacityPoliciesFor(application);
        NodeResources resources;
        NodeSpec nodeSpec;
        if (requested.type() == NodeType.tenant) {
            cluster = capacityPolicies.decideExclusivity(requested, cluster);
            Capacity actual = capacityPolicies.applyOn(requested, cluster.isExclusive());
            ClusterResources target = decideTargetResources(application, cluster, actual, capacityPolicies);
            validate(actual, target, cluster, application);
            logIfDownscaled(requested.minResources().nodes(), actual.minResources().nodes(), cluster, logger);

            resources = getNodeResources(cluster, target.nodeResources(), application, capacityPolicies);
            nodeSpec = NodeSpec.from(target.nodes(), target.groups(), resources, cluster.isExclusive(), actual.canFail(),
                                     requested.cloudAccount().orElse(nodeRepository.zone().cloud().account()),
                                     requested.clusterInfo().hostTTL());
        }
        else {
            cluster = cluster.withExclusivity(true);
            resources = getNodeResources(cluster, requested.minResources().nodeResources(), application, capacityPolicies);
            nodeSpec = NodeSpec.from(requested.type(), nodeRepository.zone().cloud().account());
        }
        return asSortedHosts(preparer.prepare(application, cluster, nodeSpec),
                             requireCompatibleResources(resources, cluster));
    }
Returns a list of nodes in the prepared or active state, matching the given constraints.
The nodes are ordered by increasing index number.
node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeRepositoryProvisioner.java