Search in sources :

Example 26 with HostMetadata

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

the class HostGroupService method getByClusterAndHostName.

public HostGroup getByClusterAndHostName(Cluster cluster, String hostName) {
    HostMetadata hostMetadata = hostMetadataRepository.findHostInClusterByName(cluster.getId(), hostName);
    String hostGroupName = hostMetadata.getHostGroup().getName();
    return getByClusterIdAndName(cluster.getId(), hostGroupName);
}
Also used : HostMetadata(com.sequenceiq.cloudbreak.domain.HostMetadata)

Example 27 with HostMetadata

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

the class HostGroupService method updateHostMetaDataStatus.

public HostMetadata updateHostMetaDataStatus(Long id, HostMetadataState status) {
    HostMetadata metaData = hostMetadataRepository.findOne(id);
    metaData.setHostMetadataState(status);
    return hostMetadataRepository.save(metaData);
}
Also used : HostMetadata(com.sequenceiq.cloudbreak.domain.HostMetadata)

Example 28 with HostMetadata

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

the class AmbariClusterUpscaleService method uploadRecipesOnNewHosts.

public void uploadRecipesOnNewHosts(Long stackId, String hostGroupName) throws CloudbreakException {
    Stack stack = stackService.getByIdWithLists(stackId);
    LOGGER.info("Start executing pre recipes");
    HostGroup hostGroup = hostGroupService.getByClusterIdAndName(stack.getCluster().getId(), hostGroupName);
    Set<HostGroup> hostGroups = hostGroupService.getByCluster(stack.getCluster().getId());
    Set<HostMetadata> hostMetadata = hostGroupService.findEmptyHostMetadataInHostGroup(hostGroup.getId());
    recipeEngine.uploadUpscaleRecipes(stack, hostGroup, hostMetadata, hostGroups);
}
Also used : HostGroup(com.sequenceiq.cloudbreak.domain.HostGroup) Stack(com.sequenceiq.cloudbreak.domain.Stack) HostMetadata(com.sequenceiq.cloudbreak.domain.HostMetadata)

Example 29 with HostMetadata

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

the class AmbariDecommissionerTest method getHostMetadata.

protected HostMetadata getHostMetadata(Long id) {
    HostMetadata hostMetadata = new HostMetadata();
    hostMetadata.setId(id);
    return hostMetadata;
}
Also used : HostMetadata(com.sequenceiq.cloudbreak.domain.HostMetadata)

Example 30 with HostMetadata

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

the class AmbariDecommissionerTest method testSelectNodesWhenHostNameShouldContainsInAscNodesAndNodes.

@Test
public void testSelectNodesWhenHostNameShouldContainsInAscNodesAndNodes() {
    String hostname1 = "10.0.0.1";
    HostMetadata healhtyNode1 = getHostMetadata(hostname1, HostMetadataState.HEALTHY);
    List<HostMetadata> nodes = Collections.singletonList(healhtyNode1);
    Map<String, Long> ascendingNodes = new LinkedHashMap<>();
    ascendingNodes.put(hostname1, 100L);
    Map<String, Long> selectedNodes = underTest.selectNodes(ascendingNodes, nodes, 1);
    Assert.assertEquals(1, selectedNodes.size());
    Assert.assertTrue(selectedNodes.keySet().contains(hostname1));
}
Also used : HostMetadata(com.sequenceiq.cloudbreak.domain.HostMetadata) LinkedHashMap(java.util.LinkedHashMap) Test(org.junit.Test)

Aggregations

HostMetadata (com.sequenceiq.cloudbreak.domain.HostMetadata)52 HostGroup (com.sequenceiq.cloudbreak.domain.HostGroup)20 AmbariClient (com.sequenceiq.ambari.client.AmbariClient)17 Cluster (com.sequenceiq.cloudbreak.domain.Cluster)16 HashSet (java.util.HashSet)16 InstanceMetaData (com.sequenceiq.cloudbreak.domain.InstanceMetaData)15 Stack (com.sequenceiq.cloudbreak.domain.Stack)14 Test (org.junit.Test)13 HttpClientConfig (com.sequenceiq.cloudbreak.client.HttpClientConfig)12 ArrayList (java.util.ArrayList)12 HashMap (java.util.HashMap)12 List (java.util.List)10 Map (java.util.Map)10 Status (com.sequenceiq.cloudbreak.api.model.Status)8 Collections.singletonMap (java.util.Collections.singletonMap)8 HostGroupAdjustmentJson (com.sequenceiq.cloudbreak.api.model.HostGroupAdjustmentJson)7 CloudbreakException (com.sequenceiq.cloudbreak.service.CloudbreakException)7 InstanceGroup (com.sequenceiq.cloudbreak.domain.InstanceGroup)6 LinkedHashMap (java.util.LinkedHashMap)5 Set (java.util.Set)5