Search in sources :

Example 16 with HostResource

use of com.yahoo.vespa.model.HostResource in project vespa by vespa-engine.

the class IndexedTest method requireProtonStreamingOnly.

@Test
public void requireProtonStreamingOnly() {
    VespaModel model = getStreamingVespaModel();
    HostResource h = model.getHostSystem().getHosts().get(0);
    String[] expectedServices = { "logserver", "configserver", "adminserver", "slobrok", "logd", "configproxy", "config-sentinel", "qrserver", "storagenode", "searchnode", "distributor", "transactionlogserver" };
    // TODO        DomContentBuilderTest.assertServices(h, expectedServices);
    ContentCluster s = model.getContentClusters().get("test");
    assertFalse(s.getSearch().hasIndexedCluster());
    StorServerConfig.Builder builder = new StorServerConfig.Builder();
    s.getStorageNodes().getConfig(builder);
    s.getStorageNodes().getChildren().get("3").getConfig(builder);
}
Also used : HostResource(com.yahoo.vespa.model.HostResource) VespaModel(com.yahoo.vespa.model.VespaModel) StorServerConfig(com.yahoo.vespa.config.content.core.StorServerConfig) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Example 17 with HostResource

use of com.yahoo.vespa.model.HostResource in project vespa by vespa-engine.

the class DomAdminBuilderBase method getConfigServersFromSpec.

List<Configserver> getConfigServersFromSpec(AbstractConfigProducer parent) {
    List<Configserver> configservers = new ArrayList<>();
    for (ConfigServerSpec spec : configServerSpecs) {
        HostSystem hostSystem = parent.getHostSystem();
        HostResource host = new HostResource(Host.createConfigServerHost(hostSystem, spec.getHostName()));
        hostSystem.addBoundHost(host);
        Configserver configserver = new Configserver(parent, spec.getHostName());
        configserver.setHostResource(host);
        configserver.setBasePort(configserver.getWantedPort());
        configserver.initService();
        configservers.add(configserver);
    }
    return configservers;
}
Also used : HostResource(com.yahoo.vespa.model.HostResource) HostSystem(com.yahoo.vespa.model.HostSystem) ConfigServerSpec(com.yahoo.config.model.api.ConfigServerSpec)

Example 18 with HostResource

use of com.yahoo.vespa.model.HostResource 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);
}
Also used : HostResource(com.yahoo.vespa.model.HostResource) ModelElement(com.yahoo.vespa.model.builder.xml.dom.ModelElement) NodesSpecification(com.yahoo.vespa.model.builder.xml.dom.NodesSpecification) ClusterMembership(com.yahoo.config.provision.ClusterMembership)

Example 19 with HostResource

use of com.yahoo.vespa.model.HostResource in project vespa by vespa-engine.

the class ContainerModelBuilder method createNodesFromNodeType.

private List<Container> createNodesFromNodeType(ContainerCluster cluster, Element nodesElement, ConfigModelContext context) {
    NodeType type = NodeType.valueOf(nodesElement.getAttribute("type"));
    ClusterSpec clusterSpec = ClusterSpec.request(ClusterSpec.Type.container, ClusterSpec.Id.from(cluster.getName()), context.getDeployState().getWantedNodeVespaVersion(), false);
    Map<HostResource, ClusterMembership> hosts = cluster.getRoot().getHostSystem().allocateHosts(clusterSpec, Capacity.fromRequiredNodeType(type), 1, log);
    return createNodesFromHosts(hosts, cluster);
}
Also used : HostResource(com.yahoo.vespa.model.HostResource) ClusterMembership(com.yahoo.config.provision.ClusterMembership) NodeType(com.yahoo.config.provision.NodeType) ClusterSpec(com.yahoo.config.provision.ClusterSpec)

Example 20 with HostResource

use of com.yahoo.vespa.model.HostResource in project vespa by vespa-engine.

the class ContainerModelBuilder method createNodesFromContentServiceReference.

private List<Container> createNodesFromContentServiceReference(ContainerCluster cluster, Element nodesElement, ConfigModelContext context) {
    // Resolve references to content clusters at the XML level because content clusters must be built after container clusters
    String referenceId = nodesElement.getAttribute("of");
    Element services = servicesRootOf(nodesElement).orElseThrow(() -> clusterReferenceNotFoundException(cluster, referenceId));
    Element referencedService = findChildById(services, referenceId).orElseThrow(() -> clusterReferenceNotFoundException(cluster, referenceId));
    if (!referencedService.getTagName().equals("content"))
        throw new IllegalArgumentException(cluster + " references service '" + referenceId + "', " + "but that is not a content service");
    Element referencedNodesElement = XML.getChild(referencedService, "nodes");
    if (referencedNodesElement == null)
        throw new IllegalArgumentException(cluster + " references service '" + referenceId + "' to supply nodes, " + "but that service has no <nodes> element");
    cluster.setHostClusterId(referenceId);
    Map<HostResource, ClusterMembership> hosts = StorageGroup.provisionHosts(NodesSpecification.from(new ModelElement(referencedNodesElement), context.getDeployState().getWantedNodeVespaVersion()), referenceId, cluster.getRoot().getHostSystem(), context.getDeployLogger());
    return createNodesFromHosts(hosts, cluster);
}
Also used : HostResource(com.yahoo.vespa.model.HostResource) ModelElement(com.yahoo.vespa.model.builder.xml.dom.ModelElement) ClusterMembership(com.yahoo.config.provision.ClusterMembership) ModelElement(com.yahoo.vespa.model.builder.xml.dom.ModelElement) Element(org.w3c.dom.Element)

Aggregations

HostResource (com.yahoo.vespa.model.HostResource)25 Test (org.junit.Test)10 ClusterMembership (com.yahoo.config.provision.ClusterMembership)6 Host (com.yahoo.vespa.model.Host)6 VespaModel (com.yahoo.vespa.model.VespaModel)6 ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)5 ModelElement (com.yahoo.vespa.model.builder.xml.dom.ModelElement)4 ArrayList (java.util.ArrayList)4 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)3 MockRoot (com.yahoo.config.model.test.MockRoot)3 ContentSearchCluster (com.yahoo.vespa.model.content.ContentSearchCluster)3 Matchers.containsString (org.hamcrest.Matchers.containsString)3 Element (org.w3c.dom.Element)3 HostSystem (com.yahoo.vespa.model.HostSystem)2 ClusterControllerContainer (com.yahoo.vespa.model.admin.clustercontroller.ClusterControllerContainer)2 NodesSpecification (com.yahoo.vespa.model.builder.xml.dom.NodesSpecification)2 Container (com.yahoo.vespa.model.container.Container)2 ProtonEngine (com.yahoo.vespa.model.content.engines.ProtonEngine)2 NodeSpec (com.yahoo.vespa.model.search.NodeSpec)2 SearchNode (com.yahoo.vespa.model.search.SearchNode)2