Search in sources :

Example 1 with DiagnosticsCollectionEvent

use of com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent in project cloudbreak by hortonworks.

the class DiagnosticsInitHandler 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();
    parameters.setUuid(event.getEvent().getHeaders().get(FlowConstants.FLOW_ID));
    Map<String, Object> parameterMap = parameters.toMap();
    LOGGER.debug("Diagnostics collection initialization started. resourceCrn: '{}', parameters: '{}'", resourceCrn, parameterMap);
    diagnosticsOperationsService.init(resourceId, parameters);
    return DiagnosticsCollectionEvent.builder().withResourceCrn(resourceCrn).withResourceId(resourceId).withSelector(START_DIAGNOSTICS_UPGRADE_EVENT.selector()).withParameters(parameters).build();
}
Also used : DiagnosticParameters(com.sequenceiq.common.model.diagnostics.DiagnosticParameters) DiagnosticsCollectionEvent(com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent)

Example 2 with DiagnosticsCollectionEvent

use of com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent in project cloudbreak by hortonworks.

the class DiagnosticsPreFlightCheckHandler 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();
    Stack stack = stackService.getByIdWithListsInTransaction(resourceId);
    Set<InstanceMetaData> instanceMetaDataSet = instanceMetaDataService.findNotTerminatedForStack(resourceId);
    instanceMetaDataSet.stream().filter(im -> im.getInstanceMetadataType() == InstanceMetadataType.GATEWAY_PRIMARY).forEach(instance -> executeNetworkReport(stack, instance));
    return DiagnosticsCollectionEvent.builder().withResourceCrn(resourceCrn).withResourceId(resourceId).withSelector(START_DIAGNOSTICS_INIT_EVENT.selector()).withParameters(parameters).build();
}
Also used : InstanceMetaData(com.sequenceiq.freeipa.entity.InstanceMetaData) InstanceMetaDataService(com.sequenceiq.freeipa.service.stack.instance.InstanceMetaDataService) Logger(org.slf4j.Logger) DiagnosticsCollectionEvent(com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent) RPCResponse(com.sequenceiq.cloudbreak.client.RPCResponse) LoggerFactory(org.slf4j.LoggerFactory) START_DIAGNOSTICS_INIT_EVENT(com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionStateSelectors.START_DIAGNOSTICS_INIT_EVENT) Set(java.util.Set) HandlerEvent(com.sequenceiq.flow.reactor.api.handler.HandlerEvent) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) FreeIpaClientException(com.sequenceiq.freeipa.client.FreeIpaClientException) NodeStatusProto(com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto) InstanceMetadataType(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceMetadataType) Inject(javax.inject.Inject) FreeIpaNodeStatusService(com.sequenceiq.freeipa.service.stack.FreeIpaNodeStatusService) Component(org.springframework.stereotype.Component) DiagnosticParameters(com.sequenceiq.common.model.diagnostics.DiagnosticParameters) StackService(com.sequenceiq.freeipa.service.stack.StackService) PREFLIGHT_CHECK_DIAGNOSTICS_EVENT(com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionHandlerSelectors.PREFLIGHT_CHECK_DIAGNOSTICS_EVENT) UsageProto(com.cloudera.thunderhead.service.common.usage.UsageProto) InstanceMetaData(com.sequenceiq.freeipa.entity.InstanceMetaData) Stack(com.sequenceiq.freeipa.entity.Stack) DiagnosticParameters(com.sequenceiq.common.model.diagnostics.DiagnosticParameters) DiagnosticsCollectionEvent(com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent) Stack(com.sequenceiq.freeipa.entity.Stack)

Example 3 with DiagnosticsCollectionEvent

use of com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent 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();
}
Also used : OrchestratorMetadataFilter(com.sequenceiq.cloudbreak.orchestrator.metadata.OrchestratorMetadataFilter) DiagnosticParameters(com.sequenceiq.common.model.diagnostics.DiagnosticParameters) DiagnosticsCollectionEvent(com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent)

Example 4 with DiagnosticsCollectionEvent

use of com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent in project cloudbreak by hortonworks.

the class DiagnosticsUploadHandler 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 upload started. resourceCrn: '{}', parameters: '{}'", resourceCrn, parameterMap);
    diagnosticsOperationsService.upload(resourceId, parameters);
    return DiagnosticsCollectionEvent.builder().withResourceCrn(resourceCrn).withResourceId(resourceId).withSelector(START_DIAGNOSTICS_CLEANUP_EVENT.selector()).withParameters(parameters).build();
}
Also used : DiagnosticParameters(com.sequenceiq.common.model.diagnostics.DiagnosticParameters) DiagnosticsCollectionEvent(com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent)

Example 5 with DiagnosticsCollectionEvent

use of com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent in project cloudbreak by hortonworks.

the class DiagnosticsCollectionActions method diagnosticsInitAction.

@Bean(name = "DIAGNOSTICS_INIT_STATE")
public Action<?, ?> diagnosticsInitAction() {
    return new AbstractDiagnosticsCollectionActions<>(DiagnosticsCollectionEvent.class) {

        @Override
        protected void doExecute(CommonContext context, DiagnosticsCollectionEvent payload, Map<Object, Object> variables) {
            String resourceCrn = payload.getResourceCrn();
            LOGGER.debug("Flow entered into DIAGNOSTICS_INIT_STATE. resourceCrn: '{}'", resourceCrn);
            DiagnosticsCollectionEvent event = DiagnosticsCollectionEvent.builder().withResourceId(payload.getResourceId()).withResourceCrn(resourceCrn).withSelector(DiagnosticsCollectionHandlerSelectors.INIT_DIAGNOSTICS_EVENT.selector()).withParameters(payload.getParameters()).build();
            sendEvent(context, event);
        }
    };
}
Also used : CommonContext(com.sequenceiq.flow.core.CommonContext) DiagnosticsCollectionEvent(com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent) Map(java.util.Map) Bean(org.springframework.context.annotation.Bean)

Aggregations

DiagnosticsCollectionEvent (com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent)58 DiagnosticParameters (com.sequenceiq.common.model.diagnostics.DiagnosticParameters)46 Test (org.junit.jupiter.api.Test)33 HandlerEvent (com.sequenceiq.flow.reactor.api.handler.HandlerEvent)23 CommonContext (com.sequenceiq.flow.core.CommonContext)13 Map (java.util.Map)13 Bean (org.springframework.context.annotation.Bean)13 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)12 Event (reactor.bus.Event)12 DiagnosticsFlowException (com.sequenceiq.freeipa.flow.freeipa.diagnostics.DiagnosticsFlowException)10 CloudbreakOrchestratorFailedException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException)9 Stack (com.sequenceiq.freeipa.entity.Stack)4 DataBusCredential (com.sequenceiq.common.api.telemetry.model.DataBusCredential)2 FreeIpaClientException (com.sequenceiq.freeipa.client.FreeIpaClientException)2 UsageProto (com.cloudera.thunderhead.service.common.usage.UsageProto)1 NodeStatusProto (com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto)1 RPCResponse (com.sequenceiq.cloudbreak.client.RPCResponse)1 CloudbreakServiceException (com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException)1 OrchestratorMetadataFilter (com.sequenceiq.cloudbreak.orchestrator.metadata.OrchestratorMetadataFilter)1 InstanceMetadataType (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceMetadataType)1