use of com.sequenceiq.cloudbreak.domain.view.StackView 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());
}
use of com.sequenceiq.cloudbreak.domain.view.StackView 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;
}
use of com.sequenceiq.cloudbreak.domain.view.StackView in project cloudbreak by hortonworks.
the class AbstractClusterSyncAction method createFlowContext.
@Override
protected ClusterSyncContext createFlowContext(String flowId, StateContext<ClusterSyncState, ClusterSyncEvent> stateContext, P payload) {
StackView stack = stackService.getByIdView(payload.getStackId());
MDCBuilder.buildMdcContext(stack.getId().toString(), stack.getName(), stack.getOwner(), "CLUSTER");
return new ClusterSyncContext(flowId, stack);
}
Aggregations