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;
}
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);
}
});
}
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);
}
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;
}
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);
}
Aggregations