Search in sources :

Example 1 with StopTelemetryResponse

use of com.sequenceiq.freeipa.flow.freeipa.downscale.event.stoptelemetry.StopTelemetryResponse in project cloudbreak by hortonworks.

the class FreeIpaDownscaleActions method collectResourcesAction.

@Bean(name = "DOWNSCALE_COLLECT_RESOURCES_STATE")
public Action<?, ?> collectResourcesAction() {
    return new AbstractDownscaleAction<>(StopTelemetryResponse.class) {

        @Override
        protected void doExecute(StackContext context, StopTelemetryResponse payload, Map<Object, Object> variables) {
            Stack stack = context.getStack();
            stackUpdater.updateStackStatus(stack.getId(), getInProgressStatus(variables), "Collecting resources");
            List<String> repairInstanceIds = getInstanceIds(variables);
            List<CloudResource> cloudResources = getCloudResources(stack);
            List<CloudInstance> cloudInstances = getCloudInstances(stack, repairInstanceIds);
            DownscaleStackCollectResourcesRequest request = new DownscaleStackCollectResourcesRequest(context.getCloudContext(), context.getCloudCredential(), context.getCloudStack(), cloudResources, cloudInstances);
            sendEvent(context, request.selector(), request);
        }
    };
}
Also used : StopTelemetryResponse(com.sequenceiq.freeipa.flow.freeipa.downscale.event.stoptelemetry.StopTelemetryResponse) DownscaleStackCollectResourcesRequest(com.sequenceiq.cloudbreak.cloud.event.resource.DownscaleStackCollectResourcesRequest) StackContext(com.sequenceiq.freeipa.flow.stack.StackContext) CloudInstance(com.sequenceiq.cloudbreak.cloud.model.CloudInstance) CloudResource(com.sequenceiq.cloudbreak.cloud.model.CloudResource) Map(java.util.Map) Stack(com.sequenceiq.freeipa.entity.Stack) Bean(org.springframework.context.annotation.Bean)

Example 2 with StopTelemetryResponse

use of com.sequenceiq.freeipa.flow.freeipa.downscale.event.stoptelemetry.StopTelemetryResponse in project cloudbreak by hortonworks.

the class StopTelemetryHandler method accept.

@Override
public void accept(Event<StopTelemetryRequest> event) {
    StopTelemetryRequest request = event.getData();
    LOGGER.info("Stop telemetry agents gracefully (if needed)...");
    telemetryAgentService.stopTelemetryAgent(request.getResourceId(), request.getInstanceIds());
    StopTelemetryResponse response = new StopTelemetryResponse(request.getResourceId());
    eventBus.notify(EventSelectorUtil.selector(StopTelemetryResponse.class), new Event<>(event.getHeaders(), response));
}
Also used : StopTelemetryResponse(com.sequenceiq.freeipa.flow.freeipa.downscale.event.stoptelemetry.StopTelemetryResponse) StopTelemetryRequest(com.sequenceiq.freeipa.flow.freeipa.downscale.event.stoptelemetry.StopTelemetryRequest)

Aggregations

StopTelemetryResponse (com.sequenceiq.freeipa.flow.freeipa.downscale.event.stoptelemetry.StopTelemetryResponse)2 DownscaleStackCollectResourcesRequest (com.sequenceiq.cloudbreak.cloud.event.resource.DownscaleStackCollectResourcesRequest)1 CloudInstance (com.sequenceiq.cloudbreak.cloud.model.CloudInstance)1 CloudResource (com.sequenceiq.cloudbreak.cloud.model.CloudResource)1 Stack (com.sequenceiq.freeipa.entity.Stack)1 StopTelemetryRequest (com.sequenceiq.freeipa.flow.freeipa.downscale.event.stoptelemetry.StopTelemetryRequest)1 StackContext (com.sequenceiq.freeipa.flow.stack.StackContext)1 Map (java.util.Map)1 Bean (org.springframework.context.annotation.Bean)1