Search in sources :

Example 76 with DiagnosticParameters

use of com.sequenceiq.common.model.diagnostics.DiagnosticParameters in project cloudbreak by hortonworks.

the class DiagnosticsService method startDiagnosticsCollection.

public FlowIdentifier startDiagnosticsCollection(BaseDiagnosticsCollectionRequest request, String stackCrn, String userCrn, String uuid) {
    Stack stack = stackService.getByCrn(stackCrn);
    MDCBuilder.buildMdcContext(stack);
    LOGGER.debug("Starting diagnostics collection for Stack. Crn: '{}'", stack.getResourceCrn());
    Telemetry telemetry = componentConfigProviderService.getTelemetry(stack.getId());
    diagnosticsCollectionValidator.validate(request, stack, telemetry);
    String clusterVersion = version;
    if (stack.getCluster() != null && stack.getCluster().getBlueprint() != null && StringUtils.isNotBlank(stack.getCluster().getBlueprint().getStackVersion())) {
        clusterVersion = stack.getCluster().getBlueprint().getStackVersion();
    }
    String accountId = Crn.fromString(stack.getResourceCrn()).getAccountId();
    boolean useDbusCnameEndpoint = entitlementService.useDataBusCNameEndpointEnabled(accountId);
    String databusEndpoint = dataBusEndpointProvider.getDataBusEndpoint(telemetry.getDatabusEndpoint(), useDbusCnameEndpoint);
    DiagnosticParameters parameters = diagnosticsDataToParameterConverter.convert(request, telemetry, StringUtils.upperCase(stack.getType().getResourceType()), clusterVersion, accountId, stack.getRegion(), databusEndpoint);
    // TODO: use DiagnosticParameters builder for UUID + decrease parameters in the converter above
    parameters.setUuid(uuid);
    DiagnosticsCollectionEvent diagnosticsCollectionEvent = DiagnosticsCollectionEvent.builder().withAccepted(new Promise<>()).withResourceId(stack.getId()).withResourceCrn(stack.getResourceCrn()).withSelector(DiagnosticsCollectionStateSelectors.START_DIAGNOSTICS_SALT_VALIDATION_EVENT.selector()).withParameters(parameters).withHosts(parameters.getHosts()).withHostGroups(parameters.getHostGroups()).withExcludeHosts(parameters.getExcludeHosts()).build();
    return reactorNotifier.notify(diagnosticsCollectionEvent, getFlowHeaders(userCrn));
}
Also used : DiagnosticParameters(com.sequenceiq.common.model.diagnostics.DiagnosticParameters) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) CmDiagnosticsCollectionEvent(com.sequenceiq.cloudbreak.core.flow2.cmdiagnostics.event.CmDiagnosticsCollectionEvent) DiagnosticsCollectionEvent(com.sequenceiq.cloudbreak.core.flow2.diagnostics.event.DiagnosticsCollectionEvent) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack)

Example 77 with DiagnosticParameters

use of com.sequenceiq.common.model.diagnostics.DiagnosticParameters in project cloudbreak by hortonworks.

the class DiagnosticsSaltPillarUpdateHandler 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();
    telemetryUpgradeService.upgradeTelemetrySaltPillars(resourceId, Set.of(TelemetryComponentType.CDP_TELEMETRY));
    return DiagnosticsCollectionEvent.builder().withResourceCrn(resourceCrn).withResourceId(resourceId).withSelector(START_DIAGNOSTICS_SALT_STATE_UPDATE_EVENT.selector()).withParameters(parameters).build();
}
Also used : DiagnosticParameters(com.sequenceiq.common.model.diagnostics.DiagnosticParameters) DiagnosticsCollectionEvent(com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent)

Example 78 with DiagnosticParameters

use of com.sequenceiq.common.model.diagnostics.DiagnosticParameters in project cloudbreak by hortonworks.

the class DiagnosticsSaltStateUpdateHandler 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();
    telemetryUpgradeService.upgradeTelemetrySaltStates(resourceId, Set.of(TelemetryComponentType.CDP_TELEMETRY));
    return DiagnosticsCollectionEvent.builder().withResourceCrn(resourceCrn).withResourceId(resourceId).withSelector(START_DIAGNOSTICS_PREFLIGHT_CHECK_EVENT.selector()).withParameters(parameters).build();
}
Also used : DiagnosticParameters(com.sequenceiq.common.model.diagnostics.DiagnosticParameters) DiagnosticsCollectionEvent(com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent)

Example 79 with DiagnosticParameters

use of com.sequenceiq.common.model.diagnostics.DiagnosticParameters in project cloudbreak by hortonworks.

the class DiagnosticsSaltValidationHandler 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();
    diagnosticsOperationsService.applyUnresponsiveHosts(resourceId, parameters);
    return DiagnosticsCollectionEvent.builder().withResourceCrn(resourceCrn).withResourceId(resourceId).withSelector(START_DIAGNOSTICS_SALT_PILLAR_UPDATE_EVENT.selector()).withParameters(parameters).build();
}
Also used : DiagnosticParameters(com.sequenceiq.common.model.diagnostics.DiagnosticParameters) DiagnosticsCollectionEvent(com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent)

Example 80 with DiagnosticParameters

use of com.sequenceiq.common.model.diagnostics.DiagnosticParameters in project cloudbreak by hortonworks.

the class DiagnosticsVmPreFlightCheckHandler 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 collection VM preflight check started. resourceCrn: '{}', parameters: '{}'", resourceCrn, parameterMap);
    if (!DiagnosticsDestination.ENG.equals(parameters.getDestination())) {
        diagnosticsOperationsService.vmPreflightCheck(resourceId, parameters);
    } else {
        LOGGER.debug("Diagnostics VM preflight check skipped.");
    }
    return DiagnosticsCollectionEvent.builder().withResourceCrn(resourceCrn).withResourceId(resourceId).withSelector(START_DIAGNOSTICS_ENSURE_MACHINE_USER_EVENT.selector()).withParameters(parameters).build();
}
Also used : DiagnosticParameters(com.sequenceiq.common.model.diagnostics.DiagnosticParameters) DiagnosticsCollectionEvent(com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent)

Aggregations

DiagnosticParameters (com.sequenceiq.common.model.diagnostics.DiagnosticParameters)97 Test (org.junit.jupiter.api.Test)67 DiagnosticsCollectionEvent (com.sequenceiq.cloudbreak.core.flow2.diagnostics.event.DiagnosticsCollectionEvent)47 DiagnosticsCollectionEvent (com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent)46 HandlerEvent (com.sequenceiq.flow.reactor.api.handler.HandlerEvent)45 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)23 Event (reactor.bus.Event)23 CloudbreakOrchestratorFailedException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException)19 DiagnosticsFlowException (com.sequenceiq.cloudbreak.core.flow2.diagnostics.DiagnosticsFlowException)11 DiagnosticsFlowException (com.sequenceiq.freeipa.flow.freeipa.diagnostics.DiagnosticsFlowException)10 DataBusCredential (com.sequenceiq.common.api.telemetry.model.DataBusCredential)4 Stack (com.sequenceiq.freeipa.entity.Stack)4 CloudStorageDiagnosticsParameters (com.sequenceiq.common.model.diagnostics.CloudStorageDiagnosticsParameters)3 CommonContext (com.sequenceiq.flow.core.CommonContext)3 Map (java.util.Map)3 Bean (org.springframework.context.annotation.Bean)3 OrchestratorMetadataFilter (com.sequenceiq.cloudbreak.orchestrator.metadata.OrchestratorMetadataFilter)2 AwsDiagnosticParameters (com.sequenceiq.common.model.diagnostics.AwsDiagnosticParameters)2 AzureDiagnosticParameters (com.sequenceiq.common.model.diagnostics.AzureDiagnosticParameters)2 FreeIpaClientException (com.sequenceiq.freeipa.client.FreeIpaClientException)2