Search in sources :

Example 11 with HostOrchestrator

use of com.sequenceiq.cloudbreak.orchestrator.host.HostOrchestrator in project cloudbreak by hortonworks.

the class ClusterHostServiceRunner method addAmbariServices.

@Transactional
public Map<String, String> addAmbariServices(Long stackId, String hostGroupName, Integer scalingAdjustment) throws CloudbreakException {
    Map<String, String> candidates;
    try {
        Stack stack = stackRepository.findOneWithLists(stackId);
        Cluster cluster = stack.getCluster();
        candidates = collectUpscaleCandidates(cluster.getId(), hostGroupName, scalingAdjustment);
        Set<Node> allNodes = collectNodes(stack);
        HostOrchestrator hostOrchestrator = hostOrchestratorResolver.get(stack.getOrchestrator().getType());
        List<GatewayConfig> gatewayConfigs = gatewayConfigService.getAllGatewayConfigs(stack);
        SaltConfig saltConfig = createSaltConfig(stack, cluster, gatewayConfigService.getPrimaryGatewayConfig(stack), gatewayConfigs);
        hostOrchestrator.runService(gatewayConfigs, allNodes, saltConfig, clusterDeletionBasedModel(stack.getId(), cluster.getId()));
    } catch (CloudbreakOrchestratorCancelledException e) {
        throw new CancellationException(e.getMessage());
    } catch (CloudbreakOrchestratorException | IOException e) {
        throw new CloudbreakException(e);
    }
    return candidates;
}
Also used : HostOrchestrator(com.sequenceiq.cloudbreak.orchestrator.host.HostOrchestrator) Node(com.sequenceiq.cloudbreak.orchestrator.model.Node) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) SaltConfig(com.sequenceiq.cloudbreak.orchestrator.model.SaltConfig) IOException(java.io.IOException) Stack(com.sequenceiq.cloudbreak.domain.Stack) CloudbreakOrchestratorException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException) CloudbreakOrchestratorCancelledException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorCancelledException) CancellationException(com.sequenceiq.cloudbreak.cloud.scheduler.CancellationException) CloudbreakException(com.sequenceiq.cloudbreak.service.CloudbreakException) GatewayConfig(com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig) Transactional(javax.transaction.Transactional)

Example 12 with HostOrchestrator

use of com.sequenceiq.cloudbreak.orchestrator.host.HostOrchestrator in project cloudbreak by hortonworks.

the class OrchestratorRecipeExecutor method postInstall.

public void postInstall(Stack stack) throws CloudbreakException {
    HostOrchestrator hostOrchestrator = hostOrchestratorResolver.get(stack.getOrchestrator().getType());
    GatewayConfig gatewayConfig = gatewayConfigService.getPrimaryGatewayConfig(stack);
    try {
        hostOrchestrator.postInstallRecipes(gatewayConfig, collectNodes(stack), clusterDeletionBasedModel(stack.getId(), stack.getCluster().getId()));
    } catch (CloudbreakOrchestratorFailedException e) {
        throw new CloudbreakException(e);
    }
}
Also used : CloudbreakOrchestratorFailedException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException) HostOrchestrator(com.sequenceiq.cloudbreak.orchestrator.host.HostOrchestrator) CloudbreakException(com.sequenceiq.cloudbreak.service.CloudbreakException) GatewayConfig(com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)

Example 13 with HostOrchestrator

use of com.sequenceiq.cloudbreak.orchestrator.host.HostOrchestrator in project cloudbreak by hortonworks.

the class OrchestratorRecipeExecutor method preTerminationRecipesOnNodes.

public void preTerminationRecipesOnNodes(Stack stack, Set<Node> nodes) throws CloudbreakException {
    if (stack.getCluster() == null) {
        throw new NotFoundException("Cluster does not found, pre-termination will not be run.");
    }
    HostOrchestrator hostOrchestrator = hostOrchestratorResolver.get(stack.getOrchestrator().getType());
    GatewayConfig gatewayConfig = gatewayConfigService.getPrimaryGatewayConfig(stack);
    try {
        hostOrchestrator.preTerminationRecipes(gatewayConfig, nodes, clusterDeletionBasedModel(stack.getId(), stack.getCluster().getId()));
    } catch (CloudbreakOrchestratorFailedException e) {
        throw new CloudbreakException(e);
    }
}
Also used : CloudbreakOrchestratorFailedException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException) HostOrchestrator(com.sequenceiq.cloudbreak.orchestrator.host.HostOrchestrator) NotFoundException(com.sequenceiq.cloudbreak.controller.NotFoundException) CloudbreakException(com.sequenceiq.cloudbreak.service.CloudbreakException) GatewayConfig(com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)

Example 14 with HostOrchestrator

use of com.sequenceiq.cloudbreak.orchestrator.host.HostOrchestrator in project cloudbreak by hortonworks.

the class AppConfig method hostOrchestrators.

@Bean
public Map<String, HostOrchestrator> hostOrchestrators() {
    Map<String, HostOrchestrator> map = new HashMap<>();
    for (HostOrchestrator hostOrchestrator : hostOrchestrators) {
        hostOrchestrator.init(simpleParallelContainerRunnerExecutor(), clusterDeletionBasedExitCriteria());
        map.put(hostOrchestrator.name(), hostOrchestrator);
    }
    return map;
}
Also used : HostOrchestrator(com.sequenceiq.cloudbreak.orchestrator.host.HostOrchestrator) HashMap(java.util.HashMap) FilterRegistrationBean(org.springframework.boot.web.servlet.FilterRegistrationBean) GenericFilterBean(org.springframework.web.filter.GenericFilterBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

HostOrchestrator (com.sequenceiq.cloudbreak.orchestrator.host.HostOrchestrator)14 GatewayConfig (com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)13 CloudbreakException (com.sequenceiq.cloudbreak.service.CloudbreakException)12 InstanceMetaData (com.sequenceiq.cloudbreak.domain.InstanceMetaData)7 Stack (com.sequenceiq.cloudbreak.domain.Stack)6 CloudbreakOrchestratorFailedException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException)6 Cluster (com.sequenceiq.cloudbreak.domain.Cluster)5 CloudbreakOrchestratorException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException)5 Node (com.sequenceiq.cloudbreak.orchestrator.model.Node)5 CancellationException (com.sequenceiq.cloudbreak.cloud.scheduler.CancellationException)4 OrchestratorType (com.sequenceiq.cloudbreak.common.model.OrchestratorType)4 PollingResult (com.sequenceiq.cloudbreak.service.PollingResult)4 ArrayList (java.util.ArrayList)4 HashSet (java.util.HashSet)4 HostOrchestratorResolver (com.sequenceiq.cloudbreak.core.bootstrap.service.host.HostOrchestratorResolver)3 CloudbreakOrchestratorCancelledException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorCancelledException)3 SaltConfig (com.sequenceiq.cloudbreak.orchestrator.model.SaltConfig)3 GatewayConfigService (com.sequenceiq.cloudbreak.service.GatewayConfigService)3 NotFoundException (com.sequenceiq.cloudbreak.controller.NotFoundException)2 HostBootstrapApiContext (com.sequenceiq.cloudbreak.core.bootstrap.service.host.context.HostBootstrapApiContext)2