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