use of com.sequenceiq.cloudbreak.orchestrator.metadata.OrchestratorMetadataFilter in project cloudbreak by hortonworks.
the class CmDiagnosticsFlowService method executeCmDiagnosticOperation.
private void executeCmDiagnosticOperation(Long stackId, String operation, Set<String> excludeHosts, CmDiagnosticsFlowOperation func) throws CloudbreakOrchestratorFailedException {
LOGGER.debug("CM Diagnostics {} will be called only on the primary gateway address", operation);
Stack stack = stackService.getByIdWithListsInTransaction(stackId);
List<GatewayConfig> gatewayConfigs = gatewayConfigService.getAllGatewayConfigs(stack);
String primaryGatewayIp = gatewayConfigService.getPrimaryGatewayIp(stack);
Set<String> hosts = Set.of(primaryGatewayIp);
OrchestratorMetadataFilter filter = OrchestratorMetadataFilter.Builder.newBuilder().includeHosts(hosts).exlcudeHosts(excludeHosts).build();
Set<Node> filteredNodes = filter.apply(stack.getAllNodes());
ClusterDeletionBasedExitCriteriaModel exitModel = new ClusterDeletionBasedExitCriteriaModel(stackId, stack.getCluster().getId());
if (filteredNodes.isEmpty()) {
LOGGER.debug("CM Diagnostics {} has been skipped. (no target minions)", operation);
} else {
LOGGER.debug("CM Diagnostics operation '{}' has been started.", operation);
func.apply(gatewayConfigs, filteredNodes, exitModel);
LOGGER.debug("CM Diagnostics operation '{}' has been finished.", operation);
}
}
use of com.sequenceiq.cloudbreak.orchestrator.metadata.OrchestratorMetadataFilter in project cloudbreak by hortonworks.
the class DiagnosticsUpgradeTelemetryHandler method executeOperation.
@Override
public Selectable executeOperation(HandlerEvent<DiagnosticsCollectionEvent> event) throws Exception {
DiagnosticsCollectionEvent data = event.getData();
Long resourceId = data.getResourceId();
String resourceCrn = data.getResourceCrn();
DiagnosticParameters parameters = data.getParameters();
OrchestratorMetadataFilter filter = OrchestratorMetadataFilter.Builder.newBuilder().includeHosts(parameters.getHosts()).includeHostGroups(parameters.getHostGroups()).exlcudeHosts(parameters.getExcludeHosts()).build();
telemetryUpgradeService.upgradeTelemetryComponent(resourceId, TelemetryComponentType.CDP_TELEMETRY, filter);
return DiagnosticsCollectionEvent.builder().withResourceCrn(resourceCrn).withResourceId(resourceId).withSelector(START_DIAGNOSTICS_VM_PREFLIGHT_CHECK_EVENT.selector()).withParameters(parameters).withHosts(parameters.getHosts()).withHostGroups(parameters.getHostGroups()).withExcludeHosts(parameters.getExcludeHosts()).build();
}
use of com.sequenceiq.cloudbreak.orchestrator.metadata.OrchestratorMetadataFilter in project cloudbreak by hortonworks.
the class DiagnosticsUpgradeTelemetryHandler method executeOperation.
@Override
public Selectable executeOperation(HandlerEvent<DiagnosticsCollectionEvent> event) throws Exception {
DiagnosticsCollectionEvent data = event.getData();
Long resourceId = data.getResourceId();
String resourceCrn = data.getResourceCrn();
DiagnosticParameters parameters = data.getParameters();
Map<String, Object> parameterMap = parameters.toMap();
LOGGER.debug("Diagnostics cdp-telemetry upgrade started. resourceCrn: '{}', parameters: '{}'", resourceCrn, parameterMap);
OrchestratorMetadataFilter filter = OrchestratorMetadataFilter.Builder.newBuilder().exlcudeHosts(parameters.getExcludeHosts()).build();
telemetryUpgradeService.upgradeTelemetryComponent(resourceId, TelemetryComponentType.CDP_TELEMETRY, filter);
return DiagnosticsCollectionEvent.builder().withResourceCrn(resourceCrn).withResourceId(resourceId).withSelector(START_DIAGNOSTICS_VM_PREFLIGHT_CHECK_EVENT.selector()).withParameters(parameters).build();
}
use of com.sequenceiq.cloudbreak.orchestrator.metadata.OrchestratorMetadataFilter in project cloudbreak by hortonworks.
the class DiagnosticsOperationsService method executeDiagnosticsOperation.
private void executeDiagnosticsOperation(Long stackId, DiagnosticParameters parameters, String operationName, DiagnosticsOperationFunction func) throws CloudbreakOrchestratorFailedException {
OrchestratorMetadata orchestratorMetadata = orchestratorMetadataProvider.getOrchestratorMetadata(stackId);
OrchestratorMetadataFilter filter = createMetadataFilter(parameters);
OrchestratorMetadata updatedOrchestratorMetadata = filter.apply(orchestratorMetadata);
LOGGER.debug("Starting diagnostics {}. stackId: '{}'", operationName, stackId);
if (CollectionUtils.isEmpty(updatedOrchestratorMetadata.getNodes())) {
LOGGER.debug("Diagnostics {} has been skipped. (no target minions)", operationName);
} else {
func.apply(updatedOrchestratorMetadata, parameters);
}
}
use of com.sequenceiq.cloudbreak.orchestrator.metadata.OrchestratorMetadataFilter in project cloudbreak by hortonworks.
the class DiagnosticsOperationsService method collectUnresponsiveHosts.
private Set<String> collectUnresponsiveHosts(Long stackId, DiagnosticParameters parameters) throws CloudbreakOrchestratorFailedException {
Set<Node> allUnresponsiveNodes = collectUnresponsiveNodes(stackId);
OrchestratorMetadataFilter filter = createMetadataFilter(parameters);
return allUnresponsiveNodes.stream().filter(filter::apply).map(Node::getHostname).collect(Collectors.toSet());
}
Aggregations