Search in sources :

Example 71 with InstanceMetaData

use of com.sequenceiq.cloudbreak.domain.InstanceMetaData in project cloudbreak by hortonworks.

the class StackRepairService method groupInstancesByHostGroups.

private UnhealthyInstances groupInstancesByHostGroups(Stack stack, Iterable<String> unhealthyInstanceIds) {
    UnhealthyInstances unhealthyInstances = new UnhealthyInstances();
    for (String instanceId : unhealthyInstanceIds) {
        InstanceMetaData instanceMetaData = instanceMetaDataRepository.findByInstanceId(stack.getId(), instanceId);
        HostMetadata hostMetadata = hostMetadataRepository.findHostInClusterByName(stack.getCluster().getId(), instanceMetaData.getDiscoveryFQDN());
        String hostGroupName = hostMetadata.getHostGroup().getName();
        unhealthyInstances.addInstance(instanceId, hostGroupName);
    }
    return unhealthyInstances;
}
Also used : InstanceMetaData(com.sequenceiq.cloudbreak.domain.InstanceMetaData) HostMetadata(com.sequenceiq.cloudbreak.domain.HostMetadata)

Aggregations

InstanceMetaData (com.sequenceiq.cloudbreak.domain.InstanceMetaData)71 InstanceGroup (com.sequenceiq.cloudbreak.domain.InstanceGroup)24 Stack (com.sequenceiq.cloudbreak.domain.Stack)23 ArrayList (java.util.ArrayList)18 HashSet (java.util.HashSet)17 Map (java.util.Map)16 HostMetadata (com.sequenceiq.cloudbreak.domain.HostMetadata)14 Test (org.junit.Test)14 HashMap (java.util.HashMap)13 CloudInstance (com.sequenceiq.cloudbreak.cloud.model.CloudInstance)12 Cluster (com.sequenceiq.cloudbreak.domain.Cluster)12 HostGroup (com.sequenceiq.cloudbreak.domain.HostGroup)11 GatewayConfig (com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)9 CloudbreakException (com.sequenceiq.cloudbreak.service.CloudbreakException)9 List (java.util.List)9 Set (java.util.Set)9 Inject (javax.inject.Inject)8 CloudContext (com.sequenceiq.cloudbreak.cloud.context.CloudContext)7 CloudCredential (com.sequenceiq.cloudbreak.cloud.model.CloudCredential)7 Matchers.anyString (org.mockito.Matchers.anyString)7