use of com.sequenceiq.cloudbreak.cluster.status.ClusterStatus in project cloudbreak by hortonworks.
the class ClusterStatusUpdater method updateClusterStatus.
private void updateClusterStatus(Stack stack, ClusterStatusResult clusterStatusResult) {
Status statusInEvent = stack.getStatus();
ClusterStatus clusterStatus = clusterStatusResult.getClusterStatus();
String statusReason = clusterStatusResult.getStatusReason();
if (isUpdateEnabled(clusterStatus)) {
if (updateClusterStatus(stack, clusterStatus)) {
statusInEvent = clusterStatus.getDetailedStackStatus().getStatus();
statusReason = clusterStatus.getStatusReason();
} else {
statusReason = "The cluster's state is up to date.";
}
}
cloudbreakEventService.fireCloudbreakEvent(stack.getId(), statusInEvent.name(), CLUSTER_AMBARI_CLUSTER_SYNCHRONIZED, Collections.singletonList(statusReason));
}
use of com.sequenceiq.cloudbreak.cluster.status.ClusterStatus in project cloudbreak by hortonworks.
the class ClusterStatusUpdater method updateClusterStatus.
private boolean updateClusterStatus(Stack stack, ClusterStatus clusterStatus) {
boolean result = false;
Cluster cluster = stack.getCluster();
Status actualStatus = stack.getStatus();
DetailedStackStatus newDetailedStackStatus = clusterStatus.getDetailedStackStatus();
Status newStatus = newDetailedStackStatus.getStatus();
if (actualStatus != newStatus) {
if (!actualStatus.equals(Status.MAINTENANCE_MODE_ENABLED) || !newStatus.equals(Status.AVAILABLE)) {
LOGGER.debug("Cluster {} status is updated from {} to {}/{}", cluster.getId(), actualStatus, newStatus, newDetailedStackStatus);
clusterService.updateClusterStatusByStackId(stack.getId(), newDetailedStackStatus, clusterStatus.getStatusReason());
result = true;
}
} else {
LOGGER.debug("Cluster {} status hasn't changed: {}", cluster.getId(), actualStatus);
}
return result;
}
Aggregations