Search in sources :

Example 11 with HostSpec

use of com.yahoo.config.provision.HostSpec in project vespa by vespa-engine.

the class DynamicDockerProvisioningTest method deployZoneApp.

private List<HostSpec> deployZoneApp(ProvisioningTester tester) {
    ApplicationId applicationId = tester.makeApplicationId();
    List<HostSpec> list = tester.prepare(applicationId, ClusterSpec.request(ClusterSpec.Type.container, ClusterSpec.Id.from("node-admin"), Version.fromString("6.42"), false), Capacity.fromRequiredNodeType(NodeType.host), 1);
    tester.activate(applicationId, ImmutableSet.copyOf(list));
    return list;
}
Also used : ApplicationId(com.yahoo.config.provision.ApplicationId) HostSpec(com.yahoo.config.provision.HostSpec)

Example 12 with HostSpec

use of com.yahoo.config.provision.HostSpec in project vespa by vespa-engine.

the class DynamicDockerProvisioningTest method non_prod_do_not_have_spares.

@Test
public void non_prod_do_not_have_spares() {
    ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.perf, RegionName.from("us-east")), flavorsConfig());
    tester.makeReadyNodes(3, "host-small", NodeType.host, 32);
    deployZoneApp(tester);
    Flavor flavor = tester.nodeRepository().getAvailableFlavors().getFlavorOrThrow("d-3");
    ApplicationId application1 = tester.makeApplicationId();
    List<HostSpec> hosts = tester.prepare(application1, ClusterSpec.request(ClusterSpec.Type.content, ClusterSpec.Id.from("myContent"), Version.fromString("6.100"), false), 3, 1, flavor.canonicalName());
    tester.activate(application1, ImmutableSet.copyOf(hosts));
    List<Node> initialSpareCapacity = findSpareCapacity(tester);
    assertThat(initialSpareCapacity.size(), is(0));
}
Also used : Zone(com.yahoo.config.provision.Zone) Node(com.yahoo.vespa.hosted.provision.Node) ApplicationId(com.yahoo.config.provision.ApplicationId) HostSpec(com.yahoo.config.provision.HostSpec) Flavor(com.yahoo.config.provision.Flavor) Test(org.junit.Test)

Example 13 with HostSpec

use of com.yahoo.config.provision.HostSpec in project vespa by vespa-engine.

the class ProvisioningTest method application_deployment_constant_application_size.

@Test
public void application_deployment_constant_application_size() {
    ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.prod, RegionName.from("us-east")));
    ApplicationId application1 = tester.makeApplicationId();
    ApplicationId application2 = tester.makeApplicationId();
    tester.makeReadyNodes(21, "default");
    // deploy
    SystemState state1 = prepare(application1, 2, 2, 3, 3, "default", tester);
    tester.activate(application1, state1.allHosts);
    // redeploy
    SystemState state2 = prepare(application1, 2, 2, 3, 3, "default", tester);
    state2.assertEquals(state1);
    tester.activate(application1, state2.allHosts);
    // deploy another application
    SystemState state1App2 = prepare(application2, 2, 2, 3, 3, "default", tester);
    assertFalse("Hosts to different apps are disjunct", state1App2.allHosts.removeAll(state1.allHosts));
    tester.activate(application2, state1App2.allHosts);
    // prepare twice
    SystemState state3 = prepare(application1, 2, 2, 3, 3, "default", tester);
    SystemState state4 = prepare(application1, 2, 2, 3, 3, "default", tester);
    state3.assertEquals(state2);
    state4.assertEquals(state3);
    tester.activate(application1, state4.allHosts);
    // remove nodes before deploying
    SystemState state5 = prepare(application1, 2, 2, 3, 3, "default", tester);
    HostSpec removed = tester.removeOne(state5.allHosts);
    tester.activate(application1, state5.allHosts);
    assertEquals(removed.hostname(), tester.nodeRepository().getNodes(application1, Node.State.inactive).get(0).hostname());
    // remove some of the clusters
    SystemState state6 = prepare(application1, 0, 2, 0, 3, "default", tester);
    tester.activate(application1, state6.allHosts);
    assertEquals(5, tester.getNodes(application1, Node.State.active).size());
    assertEquals(5, tester.getNodes(application1, Node.State.inactive).size());
    // delete app
    NestedTransaction removeTransaction = new NestedTransaction();
    tester.provisioner().remove(removeTransaction, application1);
    removeTransaction.commit();
    assertEquals(tester.toHostNames(state1.allHosts), tester.toHostNames(tester.nodeRepository().getNodes(application1, Node.State.inactive)));
    assertEquals(0, tester.getNodes(application1, Node.State.active).size());
    // other application is unaffected
    assertEquals(state1App2.hostNames(), tester.toHostNames(tester.nodeRepository().getNodes(application2, Node.State.active)));
    // fail a node from app2 and make sure it does not get inactive nodes from first
    HostSpec failed = tester.removeOne(state1App2.allHosts);
    tester.fail(failed);
    assertEquals(9, tester.getNodes(application2, Node.State.active).size());
    SystemState state2App2 = prepare(application2, 2, 2, 3, 3, "default", tester);
    assertFalse("Hosts to different apps are disjunct", state2App2.allHosts.removeAll(state1.allHosts));
    assertEquals("A new node was reserved to replace the failed one", 10, state2App2.allHosts.size());
    assertFalse("The new host is not the failed one", state2App2.allHosts.contains(failed));
    tester.activate(application2, state2App2.allHosts);
    // deploy first app again
    SystemState state7 = prepare(application1, 2, 2, 3, 3, "default", tester);
    state7.assertEquals(state1);
    tester.activate(application1, state7.allHosts);
    assertEquals(0, tester.getNodes(application1, Node.State.inactive).size());
    // restart
    HostFilter allFilter = HostFilter.all();
    HostFilter hostFilter = HostFilter.hostname(state6.allHosts.iterator().next().hostname());
    HostFilter clusterTypeFilter = HostFilter.clusterType(ClusterSpec.Type.container);
    HostFilter clusterIdFilter = HostFilter.clusterId(ClusterSpec.Id.from("container1"));
    tester.provisioner().restart(application1, allFilter);
    tester.provisioner().restart(application1, hostFilter);
    tester.provisioner().restart(application1, clusterTypeFilter);
    tester.provisioner().restart(application1, clusterIdFilter);
    tester.assertRestartCount(application1, allFilter, hostFilter, clusterTypeFilter, clusterIdFilter);
}
Also used : Zone(com.yahoo.config.provision.Zone) NestedTransaction(com.yahoo.transaction.NestedTransaction) HostFilter(com.yahoo.config.provision.HostFilter) ApplicationId(com.yahoo.config.provision.ApplicationId) HostSpec(com.yahoo.config.provision.HostSpec) Test(org.junit.Test)

Example 14 with HostSpec

use of com.yahoo.config.provision.HostSpec in project vespa by vespa-engine.

the class NodeFailTester method activate.

private void activate(ApplicationId applicationId, ClusterSpec cluster, Capacity capacity) {
    List<HostSpec> hosts = provisioner.prepare(applicationId, cluster, capacity, 1, null);
    NestedTransaction transaction = new NestedTransaction().add(new CuratorTransaction(curator));
    provisioner.activate(transaction, applicationId, hosts);
    transaction.commit();
}
Also used : CuratorTransaction(com.yahoo.vespa.curator.transaction.CuratorTransaction) NestedTransaction(com.yahoo.transaction.NestedTransaction) HostSpec(com.yahoo.config.provision.HostSpec)

Example 15 with HostSpec

use of com.yahoo.config.provision.HostSpec in project vespa by vespa-engine.

the class RetiredExpirerTest method activate.

private void activate(ApplicationId applicationId, ClusterSpec cluster, int nodes, int groups, NodeRepositoryProvisioner provisioner) {
    List<HostSpec> hosts = provisioner.prepare(applicationId, cluster, Capacity.fromNodeCount(nodes), groups, null);
    NestedTransaction transaction = new NestedTransaction().add(new CuratorTransaction(curator));
    provisioner.activate(transaction, applicationId, hosts);
    transaction.commit();
}
Also used : CuratorTransaction(com.yahoo.vespa.curator.transaction.CuratorTransaction) NestedTransaction(com.yahoo.transaction.NestedTransaction) HostSpec(com.yahoo.config.provision.HostSpec)

Aggregations

HostSpec (com.yahoo.config.provision.HostSpec)33 Test (org.junit.Test)18 Zone (com.yahoo.config.provision.Zone)14 ApplicationId (com.yahoo.config.provision.ApplicationId)13 Node (com.yahoo.vespa.hosted.provision.Node)12 ClusterSpec (com.yahoo.config.provision.ClusterSpec)10 HashSet (java.util.HashSet)7 NestedTransaction (com.yahoo.transaction.NestedTransaction)6 Version (com.yahoo.component.Version)5 Capacity (com.yahoo.config.provision.Capacity)5 Flavor (com.yahoo.config.provision.Flavor)5 List (java.util.List)5 ClusterMembership (com.yahoo.config.provision.ClusterMembership)4 Environment (com.yahoo.config.provision.Environment)4 OutOfCapacityException (com.yahoo.config.provision.OutOfCapacityException)4 Collections (java.util.Collections)4 RegionName (com.yahoo.config.provision.RegionName)3 NodeList (com.yahoo.vespa.hosted.provision.NodeList)3 JobControl (com.yahoo.vespa.hosted.provision.maintenance.JobControl)3 Agent (com.yahoo.vespa.hosted.provision.node.Agent)3