Search in sources :

Example 6 with ClusterView

use of com.sequenceiq.cloudbreak.domain.view.ClusterView in project cloudbreak by hortonworks.

the class ClusterStartFlowTriggerCondition method isFlowTriggerable.

@Override
public boolean isFlowTriggerable(Long stackId) {
    StackView stackView = stackService.getByIdView(stackId);
    ClusterView clusterView = stackView.getClusterView();
    boolean result = clusterView != null && clusterView.isStartRequested();
    if (!result) {
        LOGGER.warn("Cluster start cannot be triggered, because cluster {}", clusterView == null ? "is null" : "not in startRequested status");
    }
    return result;
}
Also used : ClusterView(com.sequenceiq.cloudbreak.domain.view.ClusterView) StackView(com.sequenceiq.cloudbreak.domain.view.StackView)

Example 7 with ClusterView

use of com.sequenceiq.cloudbreak.domain.view.ClusterView in project cloudbreak by hortonworks.

the class ClusterStopService method handleClusterStopFailure.

public void handleClusterStopFailure(StackView stackView, String errorReason) {
    ClusterView cluster = stackView.getClusterView();
    clusterService.updateClusterStatusByStackId(stackView.getId(), Status.STOP_FAILED);
    stackUpdater.updateStackStatus(stackView.getId(), DetailedStackStatus.AVAILABLE, "The Ambari cluster could not be stopped: " + errorReason);
    flowMessageService.fireEventAndLog(stackView.getId(), Msg.AMBARI_CLUSTER_STOP_FAILED, Status.STOP_FAILED.name(), errorReason);
    if (cluster.getEmailNeeded()) {
        emailSenderService.sendStopFailureEmail(stackView.getClusterView().getOwner(), stackView.getClusterView().getEmailTo(), stackUtil.extractAmbariIp(stackView), cluster.getName());
        flowMessageService.fireEventAndLog(stackView.getId(), Msg.AMBARI_CLUSTER_NOTIFICATION_EMAIL, Status.STOP_FAILED.name());
    }
}
Also used : ClusterView(com.sequenceiq.cloudbreak.domain.view.ClusterView)

Aggregations

ClusterView (com.sequenceiq.cloudbreak.domain.view.ClusterView)7 StackView (com.sequenceiq.cloudbreak.domain.view.StackView)5 HostGroup (com.sequenceiq.cloudbreak.domain.HostGroup)2 DetailedStackStatus (com.sequenceiq.cloudbreak.api.model.DetailedStackStatus)1 InstanceStatus (com.sequenceiq.cloudbreak.api.model.InstanceStatus)1 Status (com.sequenceiq.cloudbreak.api.model.Status)1 AVAILABLE (com.sequenceiq.cloudbreak.api.model.Status.AVAILABLE)1 UPDATE_FAILED (com.sequenceiq.cloudbreak.api.model.Status.UPDATE_FAILED)1 Selectable (com.sequenceiq.cloudbreak.cloud.event.Selectable)1 ClusterScaleTriggerEvent (com.sequenceiq.cloudbreak.core.flow2.event.ClusterScaleTriggerEvent)1 StackScaleTriggerEvent (com.sequenceiq.cloudbreak.core.flow2.event.StackScaleTriggerEvent)1 StackSyncTriggerEvent (com.sequenceiq.cloudbreak.core.flow2.event.StackSyncTriggerEvent)1 FlowMessageService (com.sequenceiq.cloudbreak.core.flow2.stack.FlowMessageService)1 Msg (com.sequenceiq.cloudbreak.core.flow2.stack.Msg)1 HostMetadata (com.sequenceiq.cloudbreak.domain.HostMetadata)1 StackUpdater (com.sequenceiq.cloudbreak.repository.StackUpdater)1 ClusterService (com.sequenceiq.cloudbreak.service.cluster.ClusterService)1 NotEnoughNodeException (com.sequenceiq.cloudbreak.service.cluster.NotEnoughNodeException)1 CloudbreakEventService (com.sequenceiq.cloudbreak.service.events.CloudbreakEventService)1 HostGroupService (com.sequenceiq.cloudbreak.service.hostgroup.HostGroupService)1