use of com.sequenceiq.cloudbreak.event.ResourceEvent.STACK_SYNC_INSTANCE_STATUS_RETRIEVAL_FAILED in project cloudbreak by hortonworks.
the class StackSyncService method autoSync.
public void autoSync(Stack stack, Collection<InstanceMetaData> instances, List<CloudVmInstanceStatus> instanceStatuses, InstanceSyncState defaultState, SyncConfig syncConfig) {
Map<String, InstanceSyncState> instanceSyncStates = instanceStatuses.stream().collect(Collectors.toMap(i -> i.getCloudInstance().getInstanceId(), i -> InstanceSyncState.getInstanceSyncState(i.getStatus())));
Map<InstanceSyncState, Integer> instanceStateCounts = initInstanceStateCounts();
for (InstanceMetaData instance : instances) {
try {
InstanceSyncState instanceSyncState = calculateInstanceSyncState(defaultState, instanceSyncStates, instance);
syncInstanceStatusByState(stack, instanceStateCounts, instance, instanceSyncState);
if (!syncConfig.isCmServerRunning() && InstanceSyncState.RUNNING.equals(instanceSyncState) && instance.isPrimaryGateway()) {
instanceMetaDataService.updateInstanceStatus(instance, InstanceStatus.SERVICES_UNHEALTHY, CM_SERVER_NOT_RESPONDING);
}
} catch (CloudConnectorException e) {
LOGGER.warn(e.getMessage(), e);
eventService.fireCloudbreakEvent(stack.getId(), AVAILABLE.name(), STACK_SYNC_INSTANCE_STATUS_RETRIEVAL_FAILED, Collections.singletonList(instance.getInstanceId()));
incrementInstanceStateCount(instanceStateCounts, InstanceSyncState.UNKNOWN);
}
}
handleSyncResult(stack, instanceStateCounts, syncConfig);
}
Aggregations