use of com.sequenceiq.cloudbreak.common.exception.UpgradeValidationFailedException in project cloudbreak by hortonworks.
the class ActiveCommandsValidator method validate.
@Override
public void validate(ServiceUpgradeValidationRequest validationRequest) {
ClusterApi connector = clusterApiConnectors.getConnector(validationRequest.getStack());
List<String> activeCommands = connector.clusterStatusService().getActiveCommandsList();
if (CollectionUtils.isNotEmpty(activeCommands)) {
throw new UpgradeValidationFailedException("There are active commands running on CM, upgrade is not possible. Active commands: " + String.join(",", activeCommands));
}
}
use of com.sequenceiq.cloudbreak.common.exception.UpgradeValidationFailedException in project cloudbreak by hortonworks.
the class ClusterUpgradeDiskSpaceValidationHandlerTest method testHandlerShouldReturnValidationFailedEventWhenTheDiskValidationFailed.
@Test
public void testHandlerShouldReturnValidationFailedEventWhenTheDiskValidationFailed() {
when(stackService.getByIdWithListsInTransaction(STACK_ID)).thenReturn(stack);
doThrow(new UpgradeValidationFailedException("Validation failed")).when(diskSpaceValidationService).validateFreeSpaceForUpgrade(stack, REQUIRED_FREE_SPACE);
Selectable nextFlowStepSelector = underTest.doAccept(createEvent());
assertEquals(FAILED_CLUSTER_UPGRADE_VALIDATION_EVENT.name(), nextFlowStepSelector.selector());
verify(stackService).getByIdWithListsInTransaction(STACK_ID);
verify(diskSpaceValidationService).validateFreeSpaceForUpgrade(stack, REQUIRED_FREE_SPACE);
}
use of com.sequenceiq.cloudbreak.common.exception.UpgradeValidationFailedException in project cloudbreak by hortonworks.
the class ClusterUpgradeImageValidationHandlerTest method testDoAcceptShouldReturnWithFailureEventWhenTheTheParcelsAreNotAvailable.
@Test
void testDoAcceptShouldReturnWithFailureEventWhenTheTheParcelsAreNotAvailable() {
HandlerEvent<ClusterUpgradeImageValidationEvent> event = getHandlerEvent();
ClusterUpgradeImageValidationEvent request = event.getData();
when(parcelAvailabilityService.validateAvailability(request.getTargetImage(), request.getResourceId())).thenThrow(new UpgradeValidationFailedException("Failed to get parcels."));
Selectable nextFlowStepSelector = underTest.doAccept(event);
assertEquals(FAILED_CLUSTER_UPGRADE_VALIDATION_EVENT.selector(), nextFlowStepSelector.selector());
verify(parcelAvailabilityService).validateAvailability(request.getTargetImage(), request.getResourceId());
}
use of com.sequenceiq.cloudbreak.common.exception.UpgradeValidationFailedException in project cloudbreak by hortonworks.
the class DatalakeUpgradeWaitHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<DatalakeUpgradeWaitRequest> event) {
DatalakeUpgradeWaitRequest request = event.getData();
Long sdxId = request.getResourceId();
String userId = request.getUserId();
Selectable response;
try {
LOGGER.info("Start polling cluster upgrade process for id: {}", sdxId);
PollingConfig pollingConfig = new PollingConfig(sleepTimeInSec, TimeUnit.SECONDS, durationInMinutes, TimeUnit.MINUTES);
upgradeService.waitCloudbreakFlow(sdxId, pollingConfig, "Stack Upgrade");
response = new DatalakeImageChangeEvent(sdxId, userId, request.getImageId());
} catch (UserBreakException userBreakException) {
LOGGER.error("Upgrade polling exited before timeout. Cause: ", userBreakException);
if (userBreakException.getCause() instanceof UpgradeValidationFailedException) {
response = new DatalakeUpgradeValidationFailedEvent(sdxId, userId);
} else {
response = new DatalakeUpgradeFailedEvent(sdxId, userId, userBreakException);
}
} catch (PollerStoppedException pollerStoppedException) {
LOGGER.error("Upgrade poller stopped for cluster: {}", sdxId);
response = new DatalakeUpgradeFailedEvent(sdxId, userId, new PollerStoppedException("Datalake upgrade timed out after " + durationInMinutes + " minutes"));
} catch (PollerException exception) {
LOGGER.error("Upgrade polling failed for cluster: {}", sdxId);
response = new DatalakeUpgradeFailedEvent(sdxId, userId, exception);
}
return response;
}
use of com.sequenceiq.cloudbreak.common.exception.UpgradeValidationFailedException in project cloudbreak by hortonworks.
the class SdxUpgradeService method waitCloudbreakFlow.
public void waitCloudbreakFlow(Long id, PollingConfig pollingConfig, String pollingMessage) {
SdxCluster sdxCluster = sdxService.getById(id);
cloudbreakPoller.pollUpdateUntilAvailable(pollingMessage, sdxCluster, pollingConfig);
if (cloudbreakFlowResultProvider.isValidationFailed(sdxCluster)) {
throw new UserBreakException(new UpgradeValidationFailedException("Upgrade validation failed."));
}
}
Aggregations