Search in sources :

Example 1 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 2 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 3 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)

Example 4 with HostMetadata

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

the class AmbariDecommissionerTest method getHostMetadata.

private HostMetadata getHostMetadata(String hostname2, HostMetadataState state) {
    HostMetadata healhtyNode = new HostMetadata();
    healhtyNode.setHostName(hostname2);
    healhtyNode.setHostMetadataState(state);
    return healhtyNode;
}
Also used : HostMetadata(com.sequenceiq.cloudbreak.domain.HostMetadata)

Example 5 with HostMetadata

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

the class AmbariDecommissionerTest method testSelectNodesWhenHasOneUnhealthyNodeButNotInAscendingList.

@Test
public void testSelectNodesWhenHasOneUnhealthyNodeButNotInAscendingList() {
    String hostname1 = "10.0.0.1";
    String hostname2 = "10.0.0.2";
    String hostname3 = "10.0.0.3";
    HostMetadata unhealhtyNode1 = getHostMetadata(hostname1, HostMetadataState.UNHEALTHY);
    HostMetadata healhtyNode1 = getHostMetadata(hostname2, HostMetadataState.HEALTHY);
    HostMetadata healhtyNode2 = getHostMetadata(hostname3, HostMetadataState.HEALTHY);
    List<HostMetadata> nodes = Arrays.asList(unhealhtyNode1, healhtyNode1, healhtyNode2);
    Map<String, Long> ascendingNodes = new LinkedHashMap<>();
    ascendingNodes.put(hostname2, 110L);
    ascendingNodes.put(hostname3, 120L);
    Map<String, Long> selectedNodes = underTest.selectNodes(ascendingNodes, nodes, 1);
    Assert.assertEquals(1, selectedNodes.size());
    Assert.assertTrue(selectedNodes.keySet().contains(hostname2));
}
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