use of com.sequenceiq.datalake.entity.SdxStatusEntity in project cloudbreak by hortonworks.
the class ResizeRecoveryService method validateRecovery.
@Override
public SdxRecoverableResponse validateRecovery(SdxCluster sdxCluster, SdxRecoveryRequest request) {
if (!entitlementService.isDatalakeResizeRecoveryEnabled(ThreadBasedUserCrnProvider.getAccountId())) {
return new SdxRecoverableResponse("Resize Recovery entitlement not enabled", RecoveryStatus.NON_RECOVERABLE);
}
SdxStatusEntity actualStatusForSdx = sdxStatusService.getActualStatusForSdx(sdxCluster);
DatalakeStatusEnum status = actualStatusForSdx.getStatus();
String statusReason = actualStatusForSdx.getStatusReason();
if (getOldCluster(sdxCluster).isPresent()) {
return validateRecoveryResizedClusterPresent(sdxCluster, status, statusReason);
}
return validateRecoveryOnlyOriginalCluster(sdxCluster, status, statusReason);
}
use of com.sequenceiq.datalake.entity.SdxStatusEntity 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.datalake.entity.SdxStatusEntity in project cloudbreak by hortonworks.
the class ResizeRecoveryService method validateRecovery.
public SdxRecoverableResponse validateRecovery(SdxCluster sdxCluster) {
Optional<FlowLog> flowLogOptional = flow2Handler.getFirstStateLogfromLatestFlow(sdxCluster.getId());
if (flowLogOptional.isEmpty()) {
return new SdxRecoverableResponse("No recent actions on this cluster", RecoveryStatus.NON_RECOVERABLE);
}
if (entitlementService.isDatalakeResizeRecoveryEnabled(ThreadBasedUserCrnProvider.getAccountId())) {
if (!DatalakeResizeFlowEventChainFactory.class.getSimpleName().equals(flowChainLogService.getFlowChainType(flowLogOptional.get().getFlowChainId()))) {
return new SdxRecoverableResponse("No recent resize operation", RecoveryStatus.NON_RECOVERABLE);
}
} else {
return new SdxRecoverableResponse("Resize Recovery entitlement not enabled", RecoveryStatus.NON_RECOVERABLE);
}
SdxStatusEntity actualStatusForSdx = sdxStatusService.getActualStatusForSdx(sdxCluster);
switch(actualStatusForSdx.getStatus()) {
case STOP_FAILED:
return new SdxRecoverableResponse("Resize can be recovered from a failed stop", RecoveryStatus.RECOVERABLE);
case PROVISIONING_FAILED:
return new SdxRecoverableResponse("Failed to provision, recovery will restart original data lake, and delete the new one", RecoveryStatus.RECOVERABLE);
case DATALAKE_RESTORE_FAILED:
return new SdxRecoverableResponse("Failed to restore backup to new data lake, recovery will restart original data lake, and delete the new one", RecoveryStatus.RECOVERABLE);
case DELETE_FAILED:
return new SdxRecoverableResponse("Failed to delete original data lake, not a recoverable error", RecoveryStatus.NON_RECOVERABLE);
default:
return new SdxRecoverableResponse("Resize can not be recovered from this point", RecoveryStatus.NON_RECOVERABLE);
}
}
Aggregations