Search in sources :

Example 1 with PollingResult

use of com.sequenceiq.cloudbreak.polling.PollingResult in project cloudbreak by hortonworks.

the class RemoveHostsHandler method removeHostsFromOrchestrator.

private PollingResult removeHostsFromOrchestrator(Stack stack, List<String> hostNames, HostOrchestrator hostOrchestrator, List<GatewayConfig> allGatewayConfigs) throws CloudbreakException {
    LOGGER.debug("Remove hosts from orchestrator: {}", hostNames);
    try {
        Map<String, String> removeNodePrivateIPsByFQDN = new HashMap<>();
        stack.getNotTerminatedInstanceMetaDataSet().stream().filter(instanceMetaData -> instanceMetaData.getDiscoveryFQDN() != null).filter(instanceMetaData -> hostNames.stream().anyMatch(hn -> hn.equals(instanceMetaData.getDiscoveryFQDN()))).forEach(instanceMetaData -> removeNodePrivateIPsByFQDN.put(instanceMetaData.getDiscoveryFQDN(), instanceMetaData.getPrivateIp()));
        Set<Node> remainingNodes = stackUtil.collectNodes(stack).stream().filter(node -> !removeNodePrivateIPsByFQDN.containsValue(node.getPrivateIp())).collect(Collectors.toSet());
        ExitCriteriaModel exitCriteriaModel = clusterDeletionBasedModel(stack.getId(), stack.getCluster().getId());
        hostOrchestrator.tearDown(stack, allGatewayConfigs, removeNodePrivateIPsByFQDN, remainingNodes, exitCriteriaModel);
    } catch (CloudbreakOrchestratorException e) {
        LOGGER.error("Failed to delete orchestrator components while decommissioning: ", e);
        throw new CloudbreakException("Removing selected nodes from master node failed, " + "please check if selected nodes are still reachable from master node using terminal and " + "nodes are in sync between CM, CDP and provider side or you can remove selected nodes forcefully.");
    }
    return SUCCESS;
}
Also used : Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) CloudbreakException(com.sequenceiq.cloudbreak.service.CloudbreakException) RemoveHostsRequest(com.sequenceiq.cloudbreak.reactor.api.event.orchestration.RemoveHostsRequest) LoggerFactory(org.slf4j.LoggerFactory) EventSelectorUtil(com.sequenceiq.flow.event.EventSelectorUtil) HashMap(java.util.HashMap) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) Event(reactor.bus.Event) SUCCESS(com.sequenceiq.cloudbreak.polling.PollingResult.SUCCESS) Map(java.util.Map) RemoveHostsFailed(com.sequenceiq.cloudbreak.reactor.api.event.orchestration.RemoveHostsFailed) EventHandler(com.sequenceiq.flow.reactor.api.handler.EventHandler) HostOrchestrator(com.sequenceiq.cloudbreak.orchestrator.host.HostOrchestrator) ClusterDeletionBasedExitCriteriaModel.clusterDeletionBasedModel(com.sequenceiq.cloudbreak.core.bootstrap.service.ClusterDeletionBasedExitCriteriaModel.clusterDeletionBasedModel) Logger(org.slf4j.Logger) Node(com.sequenceiq.cloudbreak.common.orchestration.Node) Set(java.util.Set) ExitCriteriaModel(com.sequenceiq.cloudbreak.orchestrator.state.ExitCriteriaModel) EventBus(reactor.bus.EventBus) CloudbreakOrchestratorException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException) Collectors(java.util.stream.Collectors) GatewayConfigService(com.sequenceiq.cloudbreak.service.GatewayConfigService) List(java.util.List) Component(org.springframework.stereotype.Component) StackUtil(com.sequenceiq.cloudbreak.util.StackUtil) RemoveHostsSuccess(com.sequenceiq.cloudbreak.reactor.api.event.orchestration.RemoveHostsSuccess) GatewayConfig(com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig) PollingResult(com.sequenceiq.cloudbreak.polling.PollingResult) StackService(com.sequenceiq.cloudbreak.service.stack.StackService) ExitCriteriaModel(com.sequenceiq.cloudbreak.orchestrator.state.ExitCriteriaModel) CloudbreakOrchestratorException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException) HashMap(java.util.HashMap) Node(com.sequenceiq.cloudbreak.common.orchestration.Node) CloudbreakException(com.sequenceiq.cloudbreak.service.CloudbreakException)

Example 2 with PollingResult

use of com.sequenceiq.cloudbreak.polling.PollingResult in project cloudbreak by hortonworks.

the class RemoveHostsHandler method accept.

@Override
public void accept(Event<RemoveHostsRequest> removeHostsRequestEvent) {
    RemoveHostsRequest request = removeHostsRequestEvent.getData();
    Set<String> hostNames = request.getHostNames();
    Selectable result;
    try {
        Stack stack = stackService.getByIdWithListsInTransaction(request.getResourceId());
        if (stack.getPrimaryGatewayInstance() != null && stack.getPrimaryGatewayInstance().isReachable()) {
            List<GatewayConfig> allGatewayConfigs = gatewayConfigService.getAllGatewayConfigs(stack);
            PollingResult orchestratorRemovalPollingResult = removeHostsFromOrchestrator(stack, new ArrayList<>(hostNames), hostOrchestrator, allGatewayConfigs);
            if (!orchestratorRemovalPollingResult.isSuccess()) {
                LOGGER.warn("Can not remove hosts from orchestrator: {}", hostNames);
            }
        } else {
            LOGGER.warn("Primary gateway is not reachable, can't remove hosts from orchestrator");
        }
        result = new RemoveHostsSuccess(request.getResourceId(), request.getHostGroupNames(), hostNames);
    } catch (Exception e) {
        result = new RemoveHostsFailed(removeHostsRequestEvent.getData().getResourceId(), e, request.getHostGroupNames(), hostNames);
    }
    eventBus.notify(result.selector(), new Event<>(removeHostsRequestEvent.getHeaders(), result));
}
Also used : RemoveHostsSuccess(com.sequenceiq.cloudbreak.reactor.api.event.orchestration.RemoveHostsSuccess) RemoveHostsFailed(com.sequenceiq.cloudbreak.reactor.api.event.orchestration.RemoveHostsFailed) CloudbreakException(com.sequenceiq.cloudbreak.service.CloudbreakException) CloudbreakOrchestratorException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) RemoveHostsRequest(com.sequenceiq.cloudbreak.reactor.api.event.orchestration.RemoveHostsRequest) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) PollingResult(com.sequenceiq.cloudbreak.polling.PollingResult) GatewayConfig(com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)

Example 3 with PollingResult

use of com.sequenceiq.cloudbreak.polling.PollingResult in project cloudbreak by hortonworks.

the class ClouderaManagerModificationService method doRestartServicesIfNeeded.

private int doRestartServicesIfNeeded(ClustersResourceApi clustersResourceApi, boolean waitForCommandExecutionOnly) throws ApiException, CloudbreakException {
    ApiCommandList apiCommandList = clustersResourceApi.listActiveCommands(stack.getName(), SUMMARY);
    Optional<ApiCommand> optionalRestartCommand = apiCommandList.getItems().stream().filter(cmd -> "Restart".equals(cmd.getName())).findFirst();
    ApiCommand restartCommand = null;
    if (optionalRestartCommand.isPresent()) {
        restartCommand = optionalRestartCommand.get();
        LOGGER.debug("Restart for Cluster services is already running with id: [{}]", restartCommand.getId());
    } else if (!waitForCommandExecutionOnly) {
        LOGGER.info("Restarting cluster services.");
        ApiRestartClusterArgs restartClusterArgs = new ApiRestartClusterArgs();
        restartClusterArgs.setRedeployClientConfiguration(true);
        restartCommand = clustersResourceApi.restartCommand(stack.getName(), restartClusterArgs);
        eventService.fireCloudbreakEvent(stack.getId(), UPDATE_IN_PROGRESS.name(), CLUSTER_CM_CLUSTER_SERVICES_RESTARTING);
    }
    if (restartCommand != null) {
        ExtendedPollingResult pollingResult = clouderaManagerPollingServiceProvider.startPollingCmServicesRestart(stack, apiClient, restartCommand.getId());
        handlePollingResult(pollingResult, "Cluster was terminated while restarting services.", "Timeout happened while restarting services.");
    }
    return getCommandId(restartCommand);
}
Also used : CloudbreakException(com.sequenceiq.cloudbreak.service.CloudbreakException) ApiBatchRequestElement(com.cloudera.api.swagger.model.ApiBatchRequestElement) ClusterClientInitException(com.sequenceiq.cloudbreak.cluster.service.ClusterClientInitException) LoggerFactory(org.slf4j.LoggerFactory) ApiService(com.cloudera.api.swagger.model.ApiService) ApiException(com.cloudera.api.swagger.client.ApiException) ClouderaManagerProductsProvider(com.sequenceiq.cloudbreak.cluster.service.ClouderaManagerProductsProvider) ParcelStatus(com.sequenceiq.cloudbreak.cm.model.ParcelStatus) ClustersResourceApi(com.cloudera.api.swagger.ClustersResourceApi) BigDecimal(java.math.BigDecimal) ApiCommandList(com.cloudera.api.swagger.model.ApiCommandList) ClouderaManagerProduct(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct) CloudbreakEventService(com.sequenceiq.cloudbreak.structuredevent.event.CloudbreakEventService) BatchResourceApi(com.cloudera.api.swagger.BatchResourceApi) Locale(java.util.Locale) Map(java.util.Map) ApiHostRefList(com.cloudera.api.swagger.model.ApiHostRefList) ClouderaManagerResourceApi(com.cloudera.api.swagger.ClouderaManagerResourceApi) HostTemplatesResourceApi(com.cloudera.api.swagger.HostTemplatesResourceApi) CLOUDERAMANAGER_VERSION_7_6_0(com.sequenceiq.cloudbreak.cmtemplate.CMRepositoryVersionUtil.CLOUDERAMANAGER_VERSION_7_6_0) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) ParcelResourceApi(com.cloudera.api.swagger.ParcelResourceApi) ParcelOperationStatus(com.sequenceiq.cloudbreak.cluster.model.ParcelOperationStatus) Versioned(com.sequenceiq.cloudbreak.common.type.Versioned) Predicate(java.util.function.Predicate) Collection(java.util.Collection) HostsResourceApi(com.cloudera.api.swagger.HostsResourceApi) PollingResultErrorHandler(com.sequenceiq.cloudbreak.cm.polling.PollingResultErrorHandler) Set(java.util.Set) ApiBatchResponse(com.cloudera.api.swagger.model.ApiBatchResponse) ExtendedPollingResult(com.sequenceiq.cloudbreak.polling.ExtendedPollingResult) HttpClientConfig(com.sequenceiq.cloudbreak.client.HttpClientConfig) Collectors(java.util.stream.Collectors) ClouderaManagerRepo(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo) Objects(java.util.Objects) List(java.util.List) ApiEntityTag(com.cloudera.api.swagger.model.ApiEntityTag) ApiRestartClusterArgs(com.cloudera.api.swagger.model.ApiRestartClusterArgs) PostConstruct(javax.annotation.PostConstruct) Optional(java.util.Optional) CancellationException(com.sequenceiq.cloudbreak.cloud.scheduler.CancellationException) PollingResult(com.sequenceiq.cloudbreak.polling.PollingResult) InstanceGroup(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup) ClusterModificationService(com.sequenceiq.cloudbreak.cluster.api.ClusterModificationService) ApiCallback(com.cloudera.api.swagger.client.ApiCallback) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) ApiCommand(com.cloudera.api.swagger.model.ApiCommand) ApiClient(com.cloudera.api.swagger.client.ApiClient) ClouderaManagerClientInitException(com.sequenceiq.cloudbreak.cm.client.ClouderaManagerClientInitException) ApiConfigStalenessStatus(com.cloudera.api.swagger.model.ApiConfigStalenessStatus) CLUSTER_CM_CLUSTER_SERVICES_STARTING(com.sequenceiq.cloudbreak.event.ResourceEvent.CLUSTER_CM_CLUSTER_SERVICES_STARTING) Function(java.util.function.Function) Scope(org.springframework.context.annotation.Scope) ServicesResourceApi(com.cloudera.api.swagger.ServicesResourceApi) ClouderaManagerPollingServiceProvider(com.sequenceiq.cloudbreak.cm.polling.ClouderaManagerPollingServiceProvider) Inject(javax.inject.Inject) StackRepoDetails(com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails) ClouderaManagerApiClientProvider(com.sequenceiq.cloudbreak.cm.client.ClouderaManagerApiClientProvider) UPDATE_IN_PROGRESS(com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status.UPDATE_IN_PROGRESS) Service(org.springframework.stereotype.Service) ApiHost(com.cloudera.api.swagger.model.ApiHost) CMRepositoryVersionUtil.isVersionNewerOrEqualThanLimited(com.sequenceiq.cloudbreak.cmtemplate.CMRepositoryVersionUtil.isVersionNewerOrEqualThanLimited) CLUSTER_CM_CLUSTER_SERVICES_RESTARTING(com.sequenceiq.cloudbreak.event.ResourceEvent.CLUSTER_CM_CLUSTER_SERVICES_RESTARTING) ApiBatchRequest(com.cloudera.api.swagger.model.ApiBatchRequest) CLOUDERAMANAGER_VERSION_7_5_1(com.sequenceiq.cloudbreak.cmtemplate.CMRepositoryVersionUtil.CLOUDERAMANAGER_VERSION_7_5_1) ApiServiceState(com.cloudera.api.swagger.model.ApiServiceState) ClusterComponentConfigProvider(com.sequenceiq.cloudbreak.cluster.service.ClusterComponentConfigProvider) CLUSTER_CM_UPDATED_REMOTE_DATA_CONTEXT(com.sequenceiq.cloudbreak.event.ResourceEvent.CLUSTER_CM_UPDATED_REMOTE_DATA_CONTEXT) Logger(org.slf4j.Logger) CLOUDERAMANAGER_VERSION_7_1_0(com.sequenceiq.cloudbreak.cmtemplate.CMRepositoryVersionUtil.CLOUDERAMANAGER_VERSION_7_1_0) CLUSTER_CM_CLUSTER_SERVICES_STARTED(com.sequenceiq.cloudbreak.event.ResourceEvent.CLUSTER_CM_CLUSTER_SERVICES_STARTED) ResourceEvent(com.sequenceiq.cloudbreak.event.ResourceEvent) URLUtils(com.sequenceiq.cloudbreak.util.URLUtils) ApplicationContext(org.springframework.context.ApplicationContext) Consumer(java.util.function.Consumer) ClusterComponent(com.sequenceiq.cloudbreak.domain.stack.cluster.ClusterComponent) HostGroup(com.sequenceiq.cloudbreak.domain.stack.cluster.host.HostGroup) InstanceMetaData(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData) HTTPMethod(com.cloudera.api.swagger.model.HTTPMethod) CLUSTER_CM_UPDATING_REMOTE_DATA_CONTEXT(com.sequenceiq.cloudbreak.event.ResourceEvent.CLUSTER_CM_UPDATING_REMOTE_DATA_CONTEXT) ApiHostRef(com.cloudera.api.swagger.model.ApiHostRef) StackType(com.sequenceiq.cloudbreak.api.endpoint.v4.common.StackType) MgmtServiceResourceApi(com.cloudera.api.swagger.MgmtServiceResourceApi) VisibleForTesting(com.google.common.annotations.VisibleForTesting) Collections(java.util.Collections) ParcelsResourceApi(com.cloudera.api.swagger.ParcelsResourceApi) ClouderaManagerApiFactory(com.sequenceiq.cloudbreak.cm.client.retry.ClouderaManagerApiFactory) ApiCommand(com.cloudera.api.swagger.model.ApiCommand) ApiCommandList(com.cloudera.api.swagger.model.ApiCommandList) ExtendedPollingResult(com.sequenceiq.cloudbreak.polling.ExtendedPollingResult) ApiRestartClusterArgs(com.cloudera.api.swagger.model.ApiRestartClusterArgs)

Example 4 with PollingResult

use of com.sequenceiq.cloudbreak.polling.PollingResult in project cloudbreak by hortonworks.

the class RemoveHostsHandler method removeHostsFromOrchestrator.

private PollingResult removeHostsFromOrchestrator(Stack stack, List<String> hostNames) throws CloudbreakException {
    LOGGER.debug("Remove hosts from orchestrator: [{}]", hostNames);
    try {
        Map<String, String> removeNodePrivateIPsByFQDN = stack.getAllInstanceMetaDataList().stream().filter(instanceMetaData -> Objects.nonNull(instanceMetaData.getDiscoveryFQDN())).filter(instanceMetaData -> hostNames.stream().anyMatch(hn -> hn.equals(instanceMetaData.getDiscoveryFQDN()))).collect(Collectors.toMap(instanceMetaData -> instanceMetaData.getDiscoveryFQDN(), instanceMeataData -> instanceMeataData.getPrivateIp()));
        Set<InstanceMetaData> remainingInstanceMetaDatas = stack.getNotDeletedInstanceMetaDataList().stream().filter(instanceMetaData -> !shouldRemove(instanceMetaData, removeNodePrivateIPsByFQDN)).collect(Collectors.toSet());
        Set<InstanceMetaData> invalidInstanceMetadata = remainingInstanceMetaDatas.stream().filter(instanceMetaData -> Objects.isNull(instanceMetaData.getDiscoveryFQDN())).collect(Collectors.toSet());
        Set<InstanceMetaData> validRemainingNodes = remainingInstanceMetaDatas.stream().filter(instanceMetaData -> Objects.nonNull(instanceMetaData.getDiscoveryFQDN())).collect(Collectors.toSet());
        Set<Node> remainingNodes = validRemainingNodes.stream().map(im -> new Node(im.getPrivateIp(), im.getPublicIp(), im.getInstanceId(), im.getInstanceGroup().getTemplate().getInstanceType(), im.getDiscoveryFQDN(), im.getInstanceGroup().getGroupName())).collect(Collectors.toSet());
        List<GatewayConfig> remainingGatewayConfigs = gatewayConfigService.getGatewayConfigs(stack, validRemainingNodes);
        LOGGER.debug("Tearing down [{}]. The following were dropped because they did not contain a FQDN [{}]. The remaining nodes are [{}].", removeNodePrivateIPsByFQDN, invalidInstanceMetadata, remainingNodes);
        hostOrchestrator.tearDown(stack, remainingGatewayConfigs, removeNodePrivateIPsByFQDN, remainingNodes, new StackBasedExitCriteriaModel(stack.getId()));
    } catch (CloudbreakOrchestratorException e) {
        LOGGER.info("Failed to delete orchestrator components while decommissioning: ", e);
        throw new CloudbreakException("Failed to delete orchestrator components while decommissioning: ", e);
    }
    return SUCCESS;
}
Also used : CloudbreakException(com.sequenceiq.cloudbreak.service.CloudbreakException) LoggerFactory(org.slf4j.LoggerFactory) EventSelectorUtil(com.sequenceiq.flow.event.EventSelectorUtil) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) RemoveHostsFromOrchestrationSuccess(com.sequenceiq.freeipa.flow.freeipa.downscale.event.removehosts.RemoveHostsFromOrchestrationSuccess) Event(reactor.bus.Event) SUCCESS(com.sequenceiq.cloudbreak.polling.PollingResult.SUCCESS) Map(java.util.Map) StackService(com.sequenceiq.freeipa.service.stack.StackService) EventHandler(com.sequenceiq.flow.reactor.api.handler.EventHandler) StackBasedExitCriteriaModel(com.sequenceiq.freeipa.orchestrator.StackBasedExitCriteriaModel) REMOVE_HOSTS_FROM_ORCHESTRATION_FAILED_EVENT(com.sequenceiq.freeipa.flow.freeipa.downscale.DownscaleFlowEvent.REMOVE_HOSTS_FROM_ORCHESTRATION_FAILED_EVENT) InstanceMetaData(com.sequenceiq.freeipa.entity.InstanceMetaData) Stack(com.sequenceiq.freeipa.entity.Stack) HostOrchestrator(com.sequenceiq.cloudbreak.orchestrator.host.HostOrchestrator) RemoveHostsFromOrchestrationRequest(com.sequenceiq.freeipa.flow.freeipa.downscale.event.removehosts.RemoveHostsFromOrchestrationRequest) Logger(org.slf4j.Logger) Node(com.sequenceiq.cloudbreak.common.orchestration.Node) Set(java.util.Set) EventBus(reactor.bus.EventBus) CloudbreakOrchestratorException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) List(java.util.List) Component(org.springframework.stereotype.Component) GatewayConfigService(com.sequenceiq.freeipa.service.GatewayConfigService) DownscaleFailureEvent(com.sequenceiq.freeipa.flow.freeipa.downscale.event.DownscaleFailureEvent) GatewayConfig(com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig) PollingResult(com.sequenceiq.cloudbreak.polling.PollingResult) BootstrapService(com.sequenceiq.freeipa.service.BootstrapService) InstanceMetaData(com.sequenceiq.freeipa.entity.InstanceMetaData) CloudbreakOrchestratorException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException) Node(com.sequenceiq.cloudbreak.common.orchestration.Node) StackBasedExitCriteriaModel(com.sequenceiq.freeipa.orchestrator.StackBasedExitCriteriaModel) CloudbreakException(com.sequenceiq.cloudbreak.service.CloudbreakException) GatewayConfig(com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)

Example 5 with PollingResult

use of com.sequenceiq.cloudbreak.polling.PollingResult in project cloudbreak by hortonworks.

the class RemoveHostsHandler method accept.

@Override
public void accept(Event<RemoveHostsFromOrchestrationRequest> removeHostsRequestEvent) {
    RemoveHostsFromOrchestrationRequest request = removeHostsRequestEvent.getData();
    Set<String> hostNames = request.getHosts();
    Selectable result;
    try {
        if (!hostNames.isEmpty()) {
            Stack stack = stackService.getByIdWithListsInTransaction(request.getResourceId());
            PollingResult orchestratorRemovalPollingResult = removeHostsFromOrchestrator(stack, new ArrayList<>(hostNames));
            if (!orchestratorRemovalPollingResult.isSuccess()) {
                LOGGER.warn("Can not remove hosts from orchestrator: {}", hostNames);
            }
            // rebootstrap to update the minion's multi-master configuration
            List<String> remainingInstanceIds = stack.getNotDeletedInstanceMetaDataList().stream().filter(metadata -> Objects.nonNull(metadata.getDiscoveryFQDN())).filter(metadata -> !hostNames.contains(metadata.getDiscoveryFQDN())).map(InstanceMetaData::getInstanceId).collect(Collectors.toList());
            bootstrapService.bootstrap(stack.getId(), remainingInstanceIds);
        }
        result = new RemoveHostsFromOrchestrationSuccess(request.getResourceId());
    } catch (Exception e) {
        LOGGER.error("Failed to remove hosts from orchestration", e);
        result = new DownscaleFailureEvent(REMOVE_HOSTS_FROM_ORCHESTRATION_FAILED_EVENT.event(), request.getResourceId(), "Removing host from orchestration", Set.of(), Map.of(), e);
    }
    eventBus.notify(result.selector(), new Event<>(removeHostsRequestEvent.getHeaders(), result));
}
Also used : CloudbreakException(com.sequenceiq.cloudbreak.service.CloudbreakException) LoggerFactory(org.slf4j.LoggerFactory) EventSelectorUtil(com.sequenceiq.flow.event.EventSelectorUtil) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) RemoveHostsFromOrchestrationSuccess(com.sequenceiq.freeipa.flow.freeipa.downscale.event.removehosts.RemoveHostsFromOrchestrationSuccess) Event(reactor.bus.Event) SUCCESS(com.sequenceiq.cloudbreak.polling.PollingResult.SUCCESS) Map(java.util.Map) StackService(com.sequenceiq.freeipa.service.stack.StackService) EventHandler(com.sequenceiq.flow.reactor.api.handler.EventHandler) StackBasedExitCriteriaModel(com.sequenceiq.freeipa.orchestrator.StackBasedExitCriteriaModel) REMOVE_HOSTS_FROM_ORCHESTRATION_FAILED_EVENT(com.sequenceiq.freeipa.flow.freeipa.downscale.DownscaleFlowEvent.REMOVE_HOSTS_FROM_ORCHESTRATION_FAILED_EVENT) InstanceMetaData(com.sequenceiq.freeipa.entity.InstanceMetaData) Stack(com.sequenceiq.freeipa.entity.Stack) HostOrchestrator(com.sequenceiq.cloudbreak.orchestrator.host.HostOrchestrator) RemoveHostsFromOrchestrationRequest(com.sequenceiq.freeipa.flow.freeipa.downscale.event.removehosts.RemoveHostsFromOrchestrationRequest) Logger(org.slf4j.Logger) Node(com.sequenceiq.cloudbreak.common.orchestration.Node) Set(java.util.Set) EventBus(reactor.bus.EventBus) CloudbreakOrchestratorException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) List(java.util.List) Component(org.springframework.stereotype.Component) GatewayConfigService(com.sequenceiq.freeipa.service.GatewayConfigService) DownscaleFailureEvent(com.sequenceiq.freeipa.flow.freeipa.downscale.event.DownscaleFailureEvent) GatewayConfig(com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig) PollingResult(com.sequenceiq.cloudbreak.polling.PollingResult) BootstrapService(com.sequenceiq.freeipa.service.BootstrapService) RemoveHostsFromOrchestrationSuccess(com.sequenceiq.freeipa.flow.freeipa.downscale.event.removehosts.RemoveHostsFromOrchestrationSuccess) DownscaleFailureEvent(com.sequenceiq.freeipa.flow.freeipa.downscale.event.DownscaleFailureEvent) RemoveHostsFromOrchestrationRequest(com.sequenceiq.freeipa.flow.freeipa.downscale.event.removehosts.RemoveHostsFromOrchestrationRequest) CloudbreakException(com.sequenceiq.cloudbreak.service.CloudbreakException) CloudbreakOrchestratorException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException) Stack(com.sequenceiq.freeipa.entity.Stack) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) PollingResult(com.sequenceiq.cloudbreak.polling.PollingResult)

Aggregations

PollingResult (com.sequenceiq.cloudbreak.polling.PollingResult)5 CloudbreakException (com.sequenceiq.cloudbreak.service.CloudbreakException)5 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)4 CloudbreakOrchestratorException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException)4 GatewayConfig (com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)4 List (java.util.List)4 Map (java.util.Map)4 Set (java.util.Set)4 Collectors (java.util.stream.Collectors)4 Inject (javax.inject.Inject)4 Logger (org.slf4j.Logger)4 LoggerFactory (org.slf4j.LoggerFactory)4 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)3 Node (com.sequenceiq.cloudbreak.common.orchestration.Node)2 HostOrchestrator (com.sequenceiq.cloudbreak.orchestrator.host.HostOrchestrator)2 SUCCESS (com.sequenceiq.cloudbreak.polling.PollingResult.SUCCESS)2 RemoveHostsFailed (com.sequenceiq.cloudbreak.reactor.api.event.orchestration.RemoveHostsFailed)2 RemoveHostsRequest (com.sequenceiq.cloudbreak.reactor.api.event.orchestration.RemoveHostsRequest)2 RemoveHostsSuccess (com.sequenceiq.cloudbreak.reactor.api.event.orchestration.RemoveHostsSuccess)2 EventSelectorUtil (com.sequenceiq.flow.event.EventSelectorUtil)2