Search in sources :

Example 1 with HostSystem

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

the class VespaDomBuilderTest method testHostSystem.

@Test
public void testHostSystem() {
    VespaModel model = createModel(hosts, services);
    HostSystem hostSystem = model.getHostSystem();
    assertThat(hostSystem.getHosts().size(), is(1));
    HostResource host = hostSystem.getHosts().get(0);
    assertThat(host, is(hostSystem.getHostByHostname(host.getHostname())));
    assertNotNull(hostSystem.getHost("node1"));
    assertThat(hostSystem.toString(), is("host '" + host.getHostname() + "'"));
}
Also used : HostResource(com.yahoo.vespa.model.HostResource) VespaModel(com.yahoo.vespa.model.VespaModel) HostSystem(com.yahoo.vespa.model.HostSystem) Test(org.junit.Test)

Example 2 with HostSystem

use of com.yahoo.vespa.model.HostSystem 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 3 with HostSystem

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

the class ModelProvisioningTest method testNodeCountForJdisc.

@Test
public void testNodeCountForJdisc() {
    String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>\n" + "\n" + "<admin version='3.0'><nodes count='1' /></admin>\n" + "<jdisc id='mydisc' version='1.0'>" + "  <handler id='myHandler'>" + "    <component id='injected' />" + "  </handler>" + "  <nodes count=\"3\"/>" + "</jdisc>" + "<jdisc id='mydisc2' version='1.0'>" + "  <document-processing/>" + "  <handler id='myHandler'>" + "    <component id='injected' />" + "  </handler>" + "  <nodes count='2' allocated-memory='45%' jvmargs='-verbosegc' preload='lib/blablamalloc.so'/>" + "</jdisc>" + "</services>";
    String hosts = "<hosts>" + " <host name='myhost0'>" + "  <alias>node0</alias>" + " </host>" + " <host name='myhost1'>" + "  <alias>node1</alias>" + " </host>" + " <host name='myhost2'>" + "  <alias>node2</alias>" + " </host>" + " <host name='myhost3'>" + "  <alias>node3</alias>" + " </host>" + " <host name='myhost4'>" + "  <alias>node4</alias>" + " </host>" + " <host name='myhost5'>" + "  <alias>node5</alias>" + " </host>" + "</hosts>";
    VespaModelCreatorWithMockPkg creator = new VespaModelCreatorWithMockPkg(null, services);
    VespaModel model = creator.create(new DeployState.Builder().modelHostProvisioner(new InMemoryProvisioner(Hosts.readFrom(new StringReader(hosts)), true)));
    assertThat(model.getContainerClusters().get("mydisc").getContainers().size(), is(3));
    assertThat(model.getContainerClusters().get("mydisc").getContainers().get(0).getConfigId(), is("mydisc/container.0"));
    assertTrue(model.getContainerClusters().get("mydisc").getContainers().get(0).isInitialized());
    assertThat(model.getContainerClusters().get("mydisc").getContainers().get(1).getConfigId(), is("mydisc/container.1"));
    assertTrue(model.getContainerClusters().get("mydisc").getContainers().get(1).isInitialized());
    assertThat(model.getContainerClusters().get("mydisc").getContainers().get(2).getConfigId(), is("mydisc/container.2"));
    assertTrue(model.getContainerClusters().get("mydisc").getContainers().get(2).isInitialized());
    assertThat(model.getContainerClusters().get("mydisc2").getContainers().size(), is(2));
    assertThat(model.getContainerClusters().get("mydisc2").getContainers().get(0).getConfigId(), is("mydisc2/container.0"));
    assertTrue(model.getContainerClusters().get("mydisc2").getContainers().get(0).isInitialized());
    assertThat(model.getContainerClusters().get("mydisc2").getContainers().get(1).getConfigId(), is("mydisc2/container.1"));
    assertTrue(model.getContainerClusters().get("mydisc2").getContainers().get(1).isInitialized());
    assertThat(model.getContainerClusters().get("mydisc").getContainers().get(0).getJvmArgs(), is(""));
    assertThat(model.getContainerClusters().get("mydisc").getContainers().get(1).getJvmArgs(), is(""));
    assertThat(model.getContainerClusters().get("mydisc").getContainers().get(2).getJvmArgs(), is(""));
    assertThat(model.getContainerClusters().get("mydisc").getContainers().get(0).getPreLoad(), is(getDefaults().underVespaHome("lib64/vespa/malloc/libvespamalloc.so")));
    assertThat(model.getContainerClusters().get("mydisc").getContainers().get(1).getPreLoad(), is(getDefaults().underVespaHome("lib64/vespa/malloc/libvespamalloc.so")));
    assertThat(model.getContainerClusters().get("mydisc").getContainers().get(2).getPreLoad(), is(getDefaults().underVespaHome("lib64/vespa/malloc/libvespamalloc.so")));
    assertThat(model.getContainerClusters().get("mydisc").getMemoryPercentage(), is(Optional.empty()));
    assertThat(model.getContainerClusters().get("mydisc2").getContainers().get(0).getJvmArgs(), is("-verbosegc"));
    assertThat(model.getContainerClusters().get("mydisc2").getContainers().get(1).getJvmArgs(), is("-verbosegc"));
    assertThat(model.getContainerClusters().get("mydisc2").getContainers().get(0).getPreLoad(), is("lib/blablamalloc.so"));
    assertThat(model.getContainerClusters().get("mydisc2").getContainers().get(1).getPreLoad(), is("lib/blablamalloc.so"));
    assertThat(model.getContainerClusters().get("mydisc2").getMemoryPercentage(), is(Optional.of(45)));
    HostSystem hostSystem = model.getHostSystem();
    assertNotNull(hostSystem.getHostByHostname("myhost0"));
    assertNotNull(hostSystem.getHostByHostname("myhost1"));
    assertNotNull(hostSystem.getHostByHostname("myhost2"));
    assertNotNull(hostSystem.getHostByHostname("myhost3"));
    assertNull(hostSystem.getHostByHostname("Nope"));
}
Also used : VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) VespaModel(com.yahoo.vespa.model.VespaModel) StringReader(java.io.StringReader) HostSystem(com.yahoo.vespa.model.HostSystem) Test(org.junit.Test)

Aggregations

HostSystem (com.yahoo.vespa.model.HostSystem)3 HostResource (com.yahoo.vespa.model.HostResource)2 VespaModel (com.yahoo.vespa.model.VespaModel)2 Test (org.junit.Test)2 ConfigServerSpec (com.yahoo.config.model.api.ConfigServerSpec)1 VespaModelCreatorWithMockPkg (com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg)1 StringReader (java.io.StringReader)1