use of com.sequenceiq.cloudbreak.orchestrator.model.NodeReachabilityResult in project cloudbreak by hortonworks.
the class ClusterHostServiceRunner method addClusterServices.
public NodeReachabilityResult addClusterServices(Long stackId, Map<String, Integer> hostGroupWithAdjustment, boolean repair) {
Stack stack = stackService.getByIdWithListsInTransaction(stackId);
Cluster cluster = stack.getCluster();
Map<String, String> candidates = collectUpscaleCandidates(cluster.getId(), hostGroupWithAdjustment);
Set<String> gatewayHosts = stack.getNotTerminatedAndNotZombieGatewayInstanceMetadata().stream().map(InstanceMetaData::getDiscoveryFQDN).collect(Collectors.toSet());
boolean candidatesContainGatewayNode = candidates.keySet().stream().anyMatch(gatewayHosts::contains);
NodeReachabilityResult nodeReachabilityResult;
if (!repair && !candidatesContainGatewayNode && targetedUpscaleSupportService.targetedUpscaleOperationSupported(stack)) {
nodeReachabilityResult = runTargetedClusterServices(stack, cluster, candidates);
} else {
nodeReachabilityResult = runClusterServices(stack, cluster, candidates);
}
return nodeReachabilityResult;
}
use of com.sequenceiq.cloudbreak.orchestrator.model.NodeReachabilityResult in project cloudbreak by hortonworks.
the class ClusterHostServiceRunner method addClusterServices.
public NodeReachabilityResult addClusterServices(Stack stack, Cluster cluster, Map<String, Integer> hostGroupWithAdjustment, boolean repair) {
Map<String, String> candidates = collectUpscaleCandidates(cluster.getId(), hostGroupWithAdjustment);
Set<String> gatewayHosts = stack.getNotTerminatedAndNotZombieGatewayInstanceMetadata().stream().map(InstanceMetaData::getDiscoveryFQDN).collect(Collectors.toSet());
boolean candidatesContainGatewayNode = candidates.keySet().stream().anyMatch(gatewayHosts::contains);
NodeReachabilityResult nodeReachabilityResult;
if (!repair && !candidatesContainGatewayNode && targetedUpscaleSupportService.targetedUpscaleOperationSupported(stack)) {
nodeReachabilityResult = runTargetedClusterServices(stack, cluster, candidates);
} else {
nodeReachabilityResult = runClusterServices(stack, cluster, candidates);
}
return nodeReachabilityResult;
}
use of com.sequenceiq.cloudbreak.orchestrator.model.NodeReachabilityResult in project cloudbreak by hortonworks.
the class ClusterManagerUpscaleServiceTest method testUpscaleIfTargetedUpscaleNotSupportedOrPrimaryGatewayChanged.
@Test
public void testUpscaleIfTargetedUpscaleNotSupportedOrPrimaryGatewayChanged() throws ClusterClientInitException {
Stack stack = getStack();
when(stackService.getByIdWithListsInTransaction(any())).thenReturn(stack);
when(clusterService.findOneWithLists(1L)).thenReturn(Optional.of(stack.getCluster()));
when(clusterHostServiceRunner.addClusterServices(any(), any(), any(), anyBoolean())).thenReturn(new NodeReachabilityResult(Set.of(), Set.of()));
doNothing().when(clusterServiceRunner).updateAmbariClientConfig(any(), any());
doNothing().when(clusterService).updateInstancesToRunning(any(), any());
when(clusterApiConnectors.getConnector(any(Stack.class))).thenReturn(clusterApi);
underTest.upscaleClusterManager(1L, Collections.singletonMap("hg", 1), true, false);
verifyNoInteractions(targetedUpscaleSupportService);
when(targetedUpscaleSupportService.targetedUpscaleOperationSupported(any())).thenReturn(Boolean.FALSE);
underTest.upscaleClusterManager(1L, Collections.singletonMap("hg", 1), false, false);
verifyNoMoreInteractions(clusterServiceRunner);
verify(clusterApi, times(2)).waitForHosts(any());
}
use of com.sequenceiq.cloudbreak.orchestrator.model.NodeReachabilityResult in project cloudbreak by hortonworks.
the class ClusterManagerUpscaleServiceTest method testUpscaleIfTargetedUpscaleSupported.
@Test
public void testUpscaleIfTargetedUpscaleSupported() throws ClusterClientInitException {
Stack stack = getStack();
when(stackService.getByIdWithListsInTransaction(any())).thenReturn(stack);
when(clusterService.findOneWithLists(1L)).thenReturn(Optional.of(stack.getCluster()));
when(clusterHostServiceRunner.addClusterServices(any(), any(), any(), anyBoolean())).thenReturn(new NodeReachabilityResult(Set.of(), Set.of()));
doNothing().when(clusterService).updateInstancesToRunning(any(), any());
when(clusterApiConnectors.getConnector(any(Stack.class))).thenReturn(clusterApi);
when(targetedUpscaleSupportService.targetedUpscaleOperationSupported(any())).thenReturn(Boolean.TRUE);
underTest.upscaleClusterManager(1L, Collections.singletonMap("hg", 1), false, false);
verifyNoInteractions(clusterServiceRunner);
verify(clusterApi).waitForHosts(any());
}
use of com.sequenceiq.cloudbreak.orchestrator.model.NodeReachabilityResult in project cloudbreak by hortonworks.
the class StackUtil method collectReachableAndUnreachableNodes.
public NodeReachabilityResult collectReachableAndUnreachableNodes(Stack stack) {
NodeReachabilityResult nodeReachabilityResult = hostOrchestrator.getResponsiveNodes(collectNodes(stack), gatewayConfigService.getPrimaryGatewayConfig(stack));
LOGGER.debug("Node reachability result: {}", nodeReachabilityResult);
return nodeReachabilityResult;
}
Aggregations