use of com.sequenceiq.cloudbreak.common.orchestration.Node in project cloudbreak by hortonworks.
the class StackUtil method collectNodes.
public Set<Node> collectNodes(Stack stack) {
Set<Node> agents = new HashSet<>();
for (InstanceGroup instanceGroup : stack.getInstanceGroups()) {
if (instanceGroup.getNodeCount() != 0) {
for (InstanceMetaData im : instanceGroup.getNotDeletedInstanceMetaDataSet()) {
if (im.getDiscoveryFQDN() != null) {
String instanceId = im.getInstanceId();
String instanceType = instanceGroup.getTemplate().getInstanceType();
agents.add(new Node(im.getPrivateIp(), im.getPublicIp(), instanceId, instanceType, im.getDiscoveryFQDN(), im.getInstanceGroupName()));
}
}
}
}
return agents;
}
use of com.sequenceiq.cloudbreak.common.orchestration.Node in project cloudbreak by hortonworks.
the class StackUtil method collectReachableAndUnreachableCandidateNodes.
public NodeReachabilityResult collectReachableAndUnreachableCandidateNodes(Stack stack, Collection<String> necessaryNodes) {
NodeReachabilityResult nodeReachabilityResult = collectReachableAndUnreachableNodes(stack);
Set<Node> reachableCandidateNodes = nodeReachabilityResult.getReachableNodes().stream().filter(node -> necessaryNodes.contains(node.getHostname())).collect(Collectors.toSet());
Set<Node> unreachableCandidateNodes = nodeReachabilityResult.getUnreachableNodes().stream().filter(node -> necessaryNodes.contains(node.getHostname())).collect(Collectors.toSet());
NodeReachabilityResult nodeReachabilityResultWithCandidates = new NodeReachabilityResult(reachableCandidateNodes, unreachableCandidateNodes);
if (!unreachableCandidateNodes.isEmpty()) {
LOGGER.warn("Some candidate nodes are unreachable: {}", nodeReachabilityResultWithCandidates.getUnreachableHosts());
}
LOGGER.debug("Candidate node reachability result: {}", nodeReachabilityResultWithCandidates);
return nodeReachabilityResultWithCandidates;
}
use of com.sequenceiq.cloudbreak.common.orchestration.Node in project cloudbreak by hortonworks.
the class OrchestratorRecipeExecutorTest method preClusterManagerStartRecipesShouldUseReachableNodes.
@Test
public void preClusterManagerStartRecipesShouldUseReachableNodes() throws CloudbreakException, CloudbreakOrchestratorFailedException, CloudbreakOrchestratorTimeoutException {
when(stack.getId()).thenReturn(1L);
Cluster cluster = new Cluster();
cluster.setId(2L);
when(stack.getCluster()).thenReturn(cluster);
when(gatewayConfigService.getPrimaryGatewayConfig(any())).thenReturn(gatewayConfig);
Set<Node> nodes = Set.of(node);
when(stackUtil.collectReachableNodes(any())).thenReturn(nodes);
underTest.preClusterManagerStartRecipes(stack);
verify(gatewayConfigService).getPrimaryGatewayConfig(stack);
verify(stackUtil).collectReachableNodes(stack);
verify(hostOrchestrator).preClusterManagerStartRecipes(eq(gatewayConfig), eq(nodes), any());
}
use of com.sequenceiq.cloudbreak.common.orchestration.Node in project cloudbreak by hortonworks.
the class MountDisks method mountDisksOnNewNodes.
public void mountDisksOnNewNodes(Long stackId, Set<String> upscaleCandidateAddresses, Set<Node> allNodes) throws CloudbreakException {
Stack stack = stackService.getByIdWithListsInTransaction(stackId);
stack.setResources(new HashSet<>(resourceService.getAllByStackId(stackId)));
if (!StackService.REATTACH_COMPATIBLE_PLATFORMS.contains(stack.getPlatformVariant())) {
return;
}
Set<Node> nodesWithDiskData = stackUtil.collectNewNodesWithDiskData(stack, upscaleCandidateAddresses);
mountDisks(stack, nodesWithDiskData, allNodes);
}
use of com.sequenceiq.cloudbreak.common.orchestration.Node in project cloudbreak by hortonworks.
the class MountDisks method mountAllDisks.
public void mountAllDisks(Long stackId) throws CloudbreakException {
Stack stack = stackService.getByIdWithListsInTransaction(stackId);
stack.setResources(new HashSet<>(resourceService.getAllByStackId(stackId)));
if (!StackService.REATTACH_COMPATIBLE_PLATFORMS.contains(stack.getPlatformVariant())) {
return;
}
Set<Node> allNodes = stackUtil.collectNodes(stack);
Set<Node> nodesWithDiskData = stackUtil.collectNodesWithDiskData(stack);
mountDisks(stack, nodesWithDiskData, allNodes);
}
Aggregations