Search in sources :

Example 1 with AbstractConfigProducerRoot

use of com.yahoo.config.model.producer.AbstractConfigProducerRoot in project vespa by vespa-engine.

the class ClusterControllerConfig method getConfig.

@Override
public void getConfig(FleetcontrollerConfig.Builder builder) {
    AbstractConfigProducerRoot root = getRoot();
    if (root instanceof VespaModel) {
        String zooKeeperAddress = root.getAdmin().getZooKeepersConfigProvider().getZooKeepersConnectionSpec();
        builder.zookeeper_server(zooKeeperAddress);
    } else {
        builder.zookeeper_server("");
    }
    builder.index(0);
    builder.cluster_name(clusterName);
    builder.fleet_controller_count(getChildren().size());
    if (initProgressTime != null) {
        builder.init_progress_time((int) initProgressTime.getMilliSeconds());
    }
    if (transitionTime != null) {
        builder.storage_transition_time((int) transitionTime.getMilliSeconds());
    }
    if (maxPrematureCrashes != null) {
        builder.max_premature_crashes(maxPrematureCrashes.intValue());
    }
    if (stableStateTimePeriod != null) {
        builder.stable_state_time_period((int) stableStateTimePeriod.getMilliSeconds());
    }
    if (minDistributorUpRatio != null) {
        builder.min_distributor_up_ratio(minDistributorUpRatio);
    }
    if (minStorageUpRatio != null) {
        builder.min_storage_up_ratio(minStorageUpRatio);
    }
    if (minSplitBits != null) {
        builder.ideal_distribution_bits(minSplitBits);
    }
    if (minNodeRatioPerGroup != null) {
        builder.min_node_ratio_per_group(minNodeRatioPerGroup);
    }
}
Also used : AbstractConfigProducerRoot(com.yahoo.config.model.producer.AbstractConfigProducerRoot) VespaModel(com.yahoo.vespa.model.VespaModel)

Example 2 with AbstractConfigProducerRoot

use of com.yahoo.config.model.producer.AbstractConfigProducerRoot in project vespa by vespa-engine.

the class ContainerModelBuilderTest method vip_status_handler_uses_file_for_hosted_vespa.

@Test
public void vip_status_handler_uses_file_for_hosted_vespa() throws Exception {
    String servicesXml = "<services>" + "<jdisc version='1.0'>" + nodesXml + "</jdisc>" + "</services>";
    ApplicationPackage applicationPackage = new MockApplicationPackage.Builder().withServices(servicesXml).build();
    VespaModel model = new VespaModel(new NullConfigModelRegistry(), new DeployState.Builder().applicationPackage(applicationPackage).properties(new DeployProperties.Builder().hostedVespa(true).build()).build(true));
    AbstractConfigProducerRoot modelRoot = model.getRoot();
    VipStatusConfig vipStatusConfig = modelRoot.getConfig(VipStatusConfig.class, "jdisc/component/status.html-status-handler");
    assertTrue(vipStatusConfig.accessdisk());
    assertEquals(ContainerModelBuilder.HOSTED_VESPA_STATUS_FILE, vipStatusConfig.statusfile());
}
Also used : NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) AbstractConfigProducerRoot(com.yahoo.config.model.producer.AbstractConfigProducerRoot) VespaModel(com.yahoo.vespa.model.VespaModel) DeployProperties(com.yahoo.config.model.deploy.DeployProperties) Matchers.containsString(org.hamcrest.Matchers.containsString) VipStatusConfig(com.yahoo.container.core.VipStatusConfig) ApplicationPackage(com.yahoo.config.application.api.ApplicationPackage) MockApplicationPackage(com.yahoo.config.model.test.MockApplicationPackage) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest) Test(org.junit.Test)

Aggregations

AbstractConfigProducerRoot (com.yahoo.config.model.producer.AbstractConfigProducerRoot)2 VespaModel (com.yahoo.vespa.model.VespaModel)2 ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)1 NullConfigModelRegistry (com.yahoo.config.model.NullConfigModelRegistry)1 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)1 DeployProperties (com.yahoo.config.model.deploy.DeployProperties)1 MockApplicationPackage (com.yahoo.config.model.test.MockApplicationPackage)1 VipStatusConfig (com.yahoo.container.core.VipStatusConfig)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1 Test (org.junit.Test)1