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);
}
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;
}
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));
}
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;
}
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));
}
Aggregations