use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceStatus in project cloudbreak by hortonworks.
the class ClusterOperationService method updateAutoRecoverableNodes.
private void updateAutoRecoverableNodes(Cluster cluster, Map<String, List<String>> autoRecoveryNodesMap, Map<String, InstanceMetaData> autoRecoveryHostMetadata) throws TransactionExecutionException {
if (!autoRecoveryNodesMap.isEmpty()) {
flowManager.triggerClusterRepairFlow(cluster.getStack().getId(), autoRecoveryNodesMap, false);
Map<String, Optional<String>> hostNamesWithReason = autoRecoveryHostMetadata.keySet().stream().collect(Collectors.toMap(host -> host, host -> Optional.empty()));
Set<InstanceStatus> expectedStates = Set.of(SERVICES_HEALTHY);
InstanceStatus newState = InstanceStatus.WAITING_FOR_REPAIR;
ResourceEvent clusterEvent = CLUSTER_AUTORECOVERY_REQUESTED_CLUSTER_EVENT;
ResourceEvent hostEvent = CLUSTER_AUTORECOVERY_REQUESTED_HOST_EVENT;
updateChangedHosts(cluster, hostNamesWithReason, expectedStates, newState, clusterEvent, Optional.of(hostEvent));
}
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceStatus in project cloudbreak by hortonworks.
the class TestUtil method instanceMetaData.
public static InstanceMetaData instanceMetaData(Long serverNumber, Long instanceGroupId, InstanceStatus instanceStatus, boolean ambariServer, InstanceGroup instanceGroup, InstanceMetadataType instanceMetadataType) {
InstanceMetaData instanceMetaData = new InstanceMetaData();
instanceMetaData.setInstanceStatus(instanceStatus);
instanceMetaData.setServer(ambariServer);
instanceMetaData.setSshPort(22);
instanceMetaData.setDiscoveryFQDN("test-" + instanceGroup.getGroupName() + "-" + instanceGroupId + '-' + serverNumber);
instanceMetaData.setInstanceId("test-" + instanceGroupId + '-' + serverNumber);
instanceMetaData.setPrivateIp("1.1." + instanceGroupId + '.' + serverNumber);
instanceMetaData.setPublicIp("2.2." + instanceGroupId + '.' + serverNumber);
instanceMetaData.setId(instanceGroupId + serverNumber);
instanceMetaData.setInstanceGroup(instanceGroup);
instanceMetaData.setStartDate(new Date().getTime());
instanceMetaData.setLifeCycle(InstanceLifeCycle.SPOT);
boolean gatewayInstanceGroup = instanceGroup.getInstanceGroupType().equals(InstanceGroupType.GATEWAY);
InstanceMetadataType imType = gatewayInstanceGroup ? InstanceMetadataType.GATEWAY_PRIMARY : instanceMetadataType;
instanceMetaData.setInstanceMetadataType(imType);
return instanceMetaData;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceStatus in project cloudbreak by hortonworks.
the class StackScalabilityCondition method isScalable.
boolean isScalable(Stack stack, String instanceGroupName) {
InstanceGroup instanceGroup = getInstanceGroupByName(stack, instanceGroupName);
List<InstanceStatus> statuses = getStatuses(instanceGroup);
return statuses.stream().noneMatch(status -> status.equals(InstanceStatus.REQUESTED));
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceStatus in project cloudbreak by hortonworks.
the class ClusterOperationService method updateFailedNodes.
private void updateFailedNodes(Cluster cluster, Map<InstanceMetaData, Optional<String>> failedHostMetadata) throws TransactionExecutionException {
if (!failedHostMetadata.isEmpty()) {
Map<String, Optional<String>> hostNamesWithReason = failedHostMetadata.entrySet().stream().filter(e -> e.getKey().getDiscoveryFQDN() != null).collect(Collectors.toMap(e -> e.getKey().getDiscoveryFQDN(), e -> e.getValue()));
Set<InstanceStatus> expectedStates = Set.of(SERVICES_HEALTHY, SERVICES_RUNNING);
InstanceStatus newState = SERVICES_UNHEALTHY;
ResourceEvent clusterEvent = CLUSTER_FAILED_NODES_REPORTED_CLUSTER_EVENT;
ResourceEvent hostEvent = CLUSTER_FAILED_NODES_REPORTED_HOST_EVENT;
updateChangedHosts(cluster, hostNamesWithReason, expectedStates, newState, clusterEvent, Optional.of(hostEvent));
}
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceStatus in project cloudbreak by hortonworks.
the class ClusterOperationService method updateNewHealthyNodes.
private void updateNewHealthyNodes(Cluster cluster, Set<String> newHealthyNodes) throws TransactionExecutionException {
if (!newHealthyNodes.isEmpty()) {
Map<String, Optional<String>> hostNamesWithReason = newHealthyNodes.stream().collect(Collectors.toMap(host -> host, host -> Optional.empty()));
Set<InstanceStatus> expectedStates = EnumSet.of(SERVICES_UNHEALTHY, SERVICES_RUNNING, DECOMMISSION_FAILED, FAILED);
InstanceStatus newState = SERVICES_HEALTHY;
ResourceEvent clusterEvent = CLUSTER_RECOVERED_NODES_REPORTED_CLUSTER_EVENT;
updateChangedHosts(cluster, hostNamesWithReason, expectedStates, newState, clusterEvent, Optional.empty());
}
}
Aggregations