Search in sources :

Example 11 with StackStatusV4Response

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackStatusV4Response in project cloudbreak by hortonworks.

the class StackClusterStatusViewToStatusConverter method convert.

public StackStatusV4Response convert(StackClusterStatusView source) {
    StackStatusV4Response response = new StackStatusV4Response();
    response.setId(source.getId());
    response.setCrn(source.getCrn());
    response.setStatus(source.getStatus());
    response.setStatusReason(source.getStatusReason());
    response.setClusterStatus(source.getClusterStatus());
    response.setClusterStatusReason(source.getClusterStatusReason());
    response.setCertExpirationState(source.getCertExpirationState());
    return response;
}
Also used : StackStatusV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackStatusV4Response)

Example 12 with StackStatusV4Response

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackStatusV4Response in project cloudbreak by hortonworks.

the class SdxClusterStatusCheckerJob method syncSdxStatus.

private void syncSdxStatus(JobExecutionContext context) {
    getCluster().ifPresent(sdx -> {
        StackStatusV4Response stack = cloudbreakInternalCrnClient.withInternalCrn().autoscaleEndpoint().getStatusByCrn(getRemoteResourceCrn());
        updateCertExpirationStateIfDifferent(sdx, stack);
        SdxStatusEntity sdxStatus = sdxStatusService.getActualStatusForSdx(sdx);
        DatalakeStatusEnum originalStatus = sdxStatus.getStatus();
        DatalakeStatusEnum updatedStatus = updateStatusIfNecessary(stack, sdx, sdxStatus);
        if (!Objects.equals(originalStatus, updatedStatus)) {
            logStateChange(originalStatus, updatedStatus);
            updateSyncScheduleIfNecessary(updatedStatus, sdx, context);
        }
    });
}
Also used : DatalakeStatusEnum(com.sequenceiq.datalake.entity.DatalakeStatusEnum) SdxStatusEntity(com.sequenceiq.datalake.entity.SdxStatusEntity) StackStatusV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackStatusV4Response)

Example 13 with StackStatusV4Response

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackStatusV4Response in project cloudbreak by hortonworks.

the class SdxClusterStatusCheckerJob method isNodeFailure.

private boolean isNodeFailure(StackStatusV4Response stack) {
    Status stackStatus = stack.getStatus();
    Status clusterStatus = stack.getClusterStatus();
    return stackStatus == Status.NODE_FAILURE || (stackStatus == Status.AVAILABLE && clusterStatus == Status.NODE_FAILURE);
}
Also used : Status(com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status)

Example 14 with StackStatusV4Response

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackStatusV4Response in project cloudbreak by hortonworks.

the class ClusterDeleteHandlerTest method getStackResponse.

private StackStatusV4Response getStackResponse(Status clusterStatus) {
    StackStatusV4Response stackResponse = new StackStatusV4Response();
    stackResponse.setStatus(clusterStatus);
    stackResponse.setClusterStatus(clusterStatus);
    return stackResponse;
}
Also used : StackStatusV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackStatusV4Response)

Example 15 with StackStatusV4Response

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackStatusV4Response in project cloudbreak by hortonworks.

the class ClusterStatusSyncHandlerTest method testOnApplicationEventWhenCBStackStatusActiveCBClusterStatusActive.

@Test
public void testOnApplicationEventWhenCBStackStatusActiveCBClusterStatusActive() {
    Cluster cluster = getACluster(ClusterState.SUSPENDED);
    when(clusterService.findById(anyLong())).thenReturn(cluster);
    AutoscaleStackV4Response mockAutoscaleResponse = mock(AutoscaleStackV4Response.class);
    StackStatusV4Response stackStatusV4Response = new StackStatusV4Response();
    stackStatusV4Response.setStatus(Status.AVAILABLE);
    stackStatusV4Response.setClusterStatus(Status.AVAILABLE);
    when(cloudbreakCommunicator.getStackStatusByCrn(anyString())).thenReturn(stackStatusV4Response);
    when(cloudbreakCommunicator.getAutoscaleClusterByCrn(CLOUDBREAK_STACK_CRN)).thenReturn(mockAutoscaleResponse);
    when(mockAutoscaleResponse.getEnvironmentCrn()).thenReturn("environmentcrn");
    underTest.onApplicationEvent(new ClusterStatusSyncEvent(AUTOSCALE_CLUSTER_ID));
    verify(clusterService).setState(AUTOSCALE_CLUSTER_ID, ClusterState.RUNNING);
    verify(cloudbreakCommunicator).getStackStatusByCrn(CLOUDBREAK_STACK_CRN);
}
Also used : ClusterStatusSyncEvent(com.sequenceiq.periscope.monitor.event.ClusterStatusSyncEvent) Cluster(com.sequenceiq.periscope.domain.Cluster) AutoscaleStackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.AutoscaleStackV4Response) StackStatusV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackStatusV4Response) Test(org.junit.Test)

Aggregations

StackStatusV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackStatusV4Response)16 Cluster (com.sequenceiq.periscope.domain.Cluster)5 Test (org.junit.Test)4 Status (com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status)3 ClusterStatusSyncEvent (com.sequenceiq.periscope.monitor.event.ClusterStatusSyncEvent)3 SdxStatusEntity (com.sequenceiq.datalake.entity.SdxStatusEntity)2 ClusterState (com.sequenceiq.periscope.api.model.ClusterState)2 StackV4Endpoint (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.StackV4Endpoint)1 AutoscaleStackV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.AutoscaleStackV4Response)1 CloudbreakClient (com.sequenceiq.cloudbreak.client.CloudbreakClient)1 AbstractEntityConverterTest (com.sequenceiq.cloudbreak.converter.AbstractEntityConverterTest)1 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)1 DatalakeStatusEnum (com.sequenceiq.datalake.entity.DatalakeStatusEnum)1 SdxCluster (com.sequenceiq.datalake.entity.SdxCluster)1 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1