use of com.sequenceiq.cloudbreak.domain.view.ClusterView in project cloudbreak by hortonworks.
the class ClusterStartService method handleClusterStartFailure.
public void handleClusterStartFailure(StackView stackView, String errorReason) {
ClusterView clusterView = stackView.getClusterView();
clusterService.updateClusterStatusByStackId(stackView.getId(), Status.START_FAILED);
stackUpdater.updateStackStatus(stackView.getId(), DetailedStackStatus.AVAILABLE, "Cluster could not be started: " + errorReason);
flowMessageService.fireEventAndLog(stackView.getId(), Msg.AMBARI_CLUSTER_START_FAILED, Status.START_FAILED.name(), errorReason);
if (clusterView.getEmailNeeded()) {
emailSenderService.sendStartFailureEmail(stackView.getClusterView().getOwner(), clusterView.getEmailTo(), stackUtil.extractAmbariIp(stackView), clusterView.getName());
flowMessageService.fireEventAndLog(stackView.getId(), Msg.AMBARI_CLUSTER_NOTIFICATION_EMAIL, Status.START_FAILED.name());
}
}
use of com.sequenceiq.cloudbreak.domain.view.ClusterView in project cloudbreak by hortonworks.
the class UpscaleFlowEventChainFactory method createFlowTriggerEventQueue.
@Override
public Queue<Selectable> createFlowTriggerEventQueue(StackAndClusterUpscaleTriggerEvent event) {
StackView stackView = stackService.getByIdView(event.getStackId());
ClusterView clusterView = stackView.getClusterView();
Queue<Selectable> flowEventChain = new ConcurrentLinkedQueue<>();
flowEventChain.add(new StackSyncTriggerEvent(STACK_SYNC_EVENT.event(), event.getStackId(), false, event.accepted()));
flowEventChain.add(new StackScaleTriggerEvent(ADD_INSTANCES_EVENT.event(), event.getStackId(), event.getInstanceGroup(), event.getAdjustment(), event.getHostNames()));
if (ScalingType.isClusterUpScale(event.getScalingType()) && clusterView != null) {
HostGroup hostGroup = hostGroupService.getByClusterIdAndInstanceGroupName(clusterView.getId(), event.getInstanceGroup());
flowEventChain.add(new ClusterScaleTriggerEvent(CLUSTER_UPSCALE_TRIGGER_EVENT.event(), stackView.getId(), hostGroup.getName(), event.getAdjustment()));
}
return flowEventChain;
}
use of com.sequenceiq.cloudbreak.domain.view.ClusterView in project cloudbreak by hortonworks.
the class ClusterTerminationFlowService method finishClusterTerminationNotAllowed.
public void finishClusterTerminationNotAllowed(ClusterViewContext context, ClusterTerminationResult payload) {
StackView stackView = context.getStack();
Long stackId = stackView.getId();
ClusterView clusterView = context.getClusterView();
flowMessageService.fireEventAndLog(stackId, Msg.CLUSTER_DELETE_FAILED, DELETE_FAILED.name(), "Operation not allowed");
clusterService.updateClusterStatusByStackId(stackId, AVAILABLE);
stackUpdater.updateStackStatus(stackId, DetailedStackStatus.AVAILABLE);
if (clusterView.getEmailNeeded()) {
sendDeleteFailedMail(clusterView, stackId);
}
}
use of com.sequenceiq.cloudbreak.domain.view.ClusterView in project cloudbreak by hortonworks.
the class ClusterTerminationFlowService method finishClusterTerminationAllowed.
public void finishClusterTerminationAllowed(ClusterViewContext context, ClusterTerminationResult payload) {
LOGGER.info("Terminate cluster result: {}", payload);
StackView stackView = context.getStack();
ClusterView clusterView = context.getClusterView();
if (clusterView != null) {
clusterService.cleanupKerberosCredential(clusterView.getId());
terminationService.finalizeClusterTermination(clusterView.getId());
clusterService.updateClusterStatusByStackId(stackView.getId(), DELETE_COMPLETED);
InMemoryStateStore.deleteCluster(clusterView.getId());
stackUpdater.updateStackStatus(stackView.getId(), DetailedStackStatus.AVAILABLE);
if (clusterView.getEmailNeeded()) {
emailSenderService.sendTerminationSuccessEmail(clusterView.getOwner(), clusterView.getEmailTo(), clusterView.getAmbariIp(), clusterView.getName());
flowMessageService.fireEventAndLog(stackView.getId(), Msg.CLUSTER_EMAIL_SENT, DELETE_COMPLETED.name());
}
}
}
use of com.sequenceiq.cloudbreak.domain.view.ClusterView in project cloudbreak by hortonworks.
the class ClusterDownscaleService method updateMetadata.
public void updateMetadata(Long stackId, Collection<String> hostNames, String hostGroupName) {
StackView stackView = stackService.getByIdView(stackId);
ClusterView clusterView = stackView.getClusterView();
hostNames.forEach(hn -> {
HostGroup hostGroup = hostGroupService.getByClusterIdAndName(clusterView.getId(), hostGroupName);
List<HostMetadata> hostMetaToRemove = hostGroup.getHostMetadata().stream().filter(md -> hostNames.contains(md.getHostName())).collect(Collectors.toList());
hostGroup.getHostMetadata().removeAll(hostMetaToRemove);
hostGroupService.save(hostGroup);
});
LOGGER.info("Start updating metadata");
for (String hostName : hostNames) {
stackService.updateMetaDataStatus(stackView.getId(), hostName, InstanceStatus.DECOMMISSIONED);
}
clusterService.updateClusterStatusByStackId(stackView.getId(), AVAILABLE);
flowMessageService.fireEventAndLog(stackId, Msg.AMBARI_CLUSTER_SCALED_DOWN, AVAILABLE.name());
}
Aggregations