use of com.yahoo.vespa.model.builder.xml.dom.NodesSpecification in project vespa by vespa-engine.
the class ContainerModelBuilder method getHostResourceFromContentClusters.
/**
* This is used in case we are on hosted Vespa and no nodes tag is supplied:
* If there are content clusters this will pick the first host in the first cluster as the container node.
* If there are no content clusters this will return empty (such that the node can be created by the container here).
*/
private Optional<HostResource> getHostResourceFromContentClusters(ContainerCluster cluster, Element containersElement, ConfigModelContext context) {
Optional<Element> services = servicesRootOf(containersElement);
if (!services.isPresent())
return Optional.empty();
List<Element> contentServices = XML.getChildren(services.get(), "content");
if (contentServices.isEmpty())
return Optional.empty();
Element contentNodesElementOrNull = XML.getChild(contentServices.get(0), "nodes");
NodesSpecification nodesSpec;
if (contentNodesElementOrNull == null)
nodesSpec = NodesSpecification.nonDedicated(1, context.getDeployState().getWantedNodeVespaVersion());
else
nodesSpec = NodesSpecification.from(new ModelElement(contentNodesElementOrNull), context.getDeployState().getWantedNodeVespaVersion());
Map<HostResource, ClusterMembership> hosts = StorageGroup.provisionHosts(nodesSpec, contentServices.get(0).getAttribute("id"), cluster.getRoot().getHostSystem(), context.getDeployLogger());
return Optional.of(hosts.keySet().iterator().next());
}
use of com.yahoo.vespa.model.builder.xml.dom.NodesSpecification in project vespa by vespa-engine.
the class ContainerModelBuilder method createNodesFromNodeCount.
private List<Container> createNodesFromNodeCount(ContainerCluster cluster, Element nodesElement, ConfigModelContext context) {
NodesSpecification nodesSpecification = NodesSpecification.from(new ModelElement(nodesElement), context.getDeployState().getWantedNodeVespaVersion());
Map<HostResource, ClusterMembership> hosts = nodesSpecification.provision(cluster.getRoot().getHostSystem(), ClusterSpec.Type.container, ClusterSpec.Id.from(cluster.getName()), log);
return createNodesFromHosts(hosts, cluster);
}
Aggregations