Search in sources :

Example 1 with ClusterId

use of com.yahoo.vespa.applicationmodel.ClusterId in project vespa by vespa-engine.

the class UnionMonitorManagerTest method nodeAdminOutsideContainer.

@Test
public void nodeAdminOutsideContainer() {
    boolean inContainer = false;
    // When nodeAdminInContainer is set, then only the node admin cluster should use health
    testWith(inContainer, ZONE_APPLICATION_ID, NODE_ADMIN, CONTAINER, 0, 1);
    testWith(inContainer, ApplicationId.fromSerializedForm("a:b:default"), NODE_ADMIN, CONTAINER, 1, 0);
    testWith(inContainer, ZONE_APPLICATION_ID, new ClusterId("foo"), CONTAINER, 1, 0);
    testWith(inContainer, ZONE_APPLICATION_ID, NODE_ADMIN, new ServiceType("foo"), 1, 0);
}
Also used : ClusterId(com.yahoo.vespa.applicationmodel.ClusterId) ServiceType(com.yahoo.vespa.applicationmodel.ServiceType) Test(org.junit.Test)

Example 2 with ClusterId

use of com.yahoo.vespa.applicationmodel.ClusterId in project vespa by vespa-engine.

the class ModelGenerator method toServiceClusterKey.

private ServiceClusterKey toServiceClusterKey(ServiceInfo serviceInfo) {
    ClusterId clusterId = getClusterId(serviceInfo);
    ServiceType serviceType = toServiceType(serviceInfo);
    return new ServiceClusterKey(clusterId, serviceType);
}
Also used : ServiceClusterKey(com.yahoo.vespa.applicationmodel.ServiceClusterKey) ClusterId(com.yahoo.vespa.applicationmodel.ClusterId) ServiceType(com.yahoo.vespa.applicationmodel.ServiceType)

Example 3 with ClusterId

use of com.yahoo.vespa.applicationmodel.ClusterId in project vespa by vespa-engine.

the class ClusterControllerClientFactoryMock method setAllDummyNodesAsUp.

public void setAllDummyNodesAsUp() {
    for (ApplicationInstance app : DummyInstanceLookupService.getApplications()) {
        Set<HostName> hosts = DummyInstanceLookupService.getContentHosts(app.reference());
        for (HostName host : hosts) {
            ClusterId clusterName = VespaModelUtil.getContentClusterName(app, host);
            int storageNodeIndex = VespaModelUtil.getStorageNodeIndex(app, host);
            String globalMapKey = clusterName.s() + storageNodeIndex;
            nodes.put(globalMapKey, ClusterControllerNodeState.UP);
        }
    }
}
Also used : ApplicationInstance(com.yahoo.vespa.applicationmodel.ApplicationInstance) ClusterId(com.yahoo.vespa.applicationmodel.ClusterId) HostName(com.yahoo.vespa.applicationmodel.HostName)

Example 4 with ClusterId

use of com.yahoo.vespa.applicationmodel.ClusterId in project vespa by vespa-engine.

the class ClusterControllerClientFactoryMock method isInMaintenance.

public boolean isInMaintenance(ApplicationInstance appInstance, HostName hostName) {
    try {
        ClusterId clusterName = VespaModelUtil.getContentClusterName(appInstance, hostName);
        int storageNodeIndex = VespaModelUtil.getStorageNodeIndex(appInstance, hostName);
        String globalMapKey = clusterName.s() + storageNodeIndex;
        return nodes.getOrDefault(globalMapKey, ClusterControllerNodeState.UP) == ClusterControllerNodeState.MAINTENANCE;
    } catch (Exception e) {
        // Catch all - meant to catch cases where the node is not part of a storage cluster
        return false;
    }
}
Also used : ClusterId(com.yahoo.vespa.applicationmodel.ClusterId) IOException(java.io.IOException)

Example 5 with ClusterId

use of com.yahoo.vespa.applicationmodel.ClusterId in project vespa by vespa-engine.

the class VespaModelUtilTest method testGetContentClusterName.

@Test
public void testGetContentClusterName() {
    ClusterId contentClusterName = VespaModelUtil.getContentClusterName(application, distributor0.hostName());
    assertThat(CONTENT_CLUSTER_ID).isEqualTo(contentClusterName);
}
Also used : ClusterId(com.yahoo.vespa.applicationmodel.ClusterId) Test(org.junit.Test)

Aggregations

ClusterId (com.yahoo.vespa.applicationmodel.ClusterId)14 ServiceType (com.yahoo.vespa.applicationmodel.ServiceType)7 Test (org.junit.Test)7 HostName (com.yahoo.vespa.applicationmodel.HostName)6 ApplicationInstanceReference (com.yahoo.vespa.applicationmodel.ApplicationInstanceReference)5 ConfigId (com.yahoo.vespa.applicationmodel.ConfigId)5 ApplicationInstance (com.yahoo.vespa.applicationmodel.ApplicationInstance)4 ApplicationInstanceId (com.yahoo.vespa.applicationmodel.ApplicationInstanceId)4 ServiceCluster (com.yahoo.vespa.applicationmodel.ServiceCluster)4 ServiceInstance (com.yahoo.vespa.applicationmodel.ServiceInstance)4 TenantId (com.yahoo.vespa.applicationmodel.TenantId)4 ApplicationId (com.yahoo.config.provision.ApplicationId)3 ServiceClusterKey (com.yahoo.vespa.applicationmodel.ServiceClusterKey)2 IOException (java.io.IOException)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 Map (java.util.Map)2 ApplicationInfo (com.yahoo.config.model.api.ApplicationInfo)1 HostInfo (com.yahoo.config.model.api.HostInfo)1 ServiceInfo (com.yahoo.config.model.api.ServiceInfo)1