Search in sources :

Example 6 with DiagnosticParameters

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

Example 7 with DiagnosticParameters

use of com.sequenceiq.common.model.diagnostics.DiagnosticParameters 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).withHosts(data.getHosts()).withHostGroups(data.getHostGroups()).withExcludeHosts(data.getExcludeHosts()).build();
}
Also used : DiagnosticParameters(com.sequenceiq.common.model.diagnostics.DiagnosticParameters) DiagnosticsCollectionEvent(com.sequenceiq.cloudbreak.core.flow2.diagnostics.event.DiagnosticsCollectionEvent)

Example 8 with DiagnosticParameters

use of com.sequenceiq.common.model.diagnostics.DiagnosticParameters 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 9 with DiagnosticParameters

use of com.sequenceiq.common.model.diagnostics.DiagnosticParameters 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 10 with DiagnosticParameters

use of com.sequenceiq.common.model.diagnostics.DiagnosticParameters 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)

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