Search in sources :

Example 1 with OrchestratorGrainRunnerParams

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

the class ClusterHostServiceRunner method createOrchestratorGrainRunnerParams.

private OrchestratorGrainRunnerParams createOrchestratorGrainRunnerParams(Stack stack, Cluster cluster, Set<Node> nodes, GrainOperation grainOperation) {
    Set<String> reachableHostnames = nodes.stream().map(Node::getHostname).collect(Collectors.toSet());
    OrchestratorGrainRunnerParams grainRunnerParams = new OrchestratorGrainRunnerParams();
    InstanceMetaData gatewayInstance = stack.getPrimaryGatewayInstance();
    grainRunnerParams.setPrimaryGatewayConfig(gatewayConfigService.getGatewayConfig(stack, gatewayInstance, stack.getCluster().hasGateway()));
    grainRunnerParams.setTargetHostNames(reachableHostnames);
    grainRunnerParams.setAllNodes(nodes);
    grainRunnerParams.setExitCriteriaModel(ClusterDeletionBasedExitCriteriaModel.clusterDeletionBasedModel(stack.getId(), cluster.getId()));
    grainRunnerParams.setKey("roles");
    grainRunnerParams.setValue("startup_mount");
    grainRunnerParams.setGrainOperation(grainOperation);
    return grainRunnerParams;
}
Also used : InstanceMetaData(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData) OrchestratorGrainRunnerParams(com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorGrainRunnerParams)

Example 2 with OrchestratorGrainRunnerParams

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

the class RdsRecoverySetupService method modifyRecoverRole.

private void modifyRecoverRole(Long stackId, GrainOperation operation) throws CloudbreakOrchestratorFailedException {
    OrchestratorGrainRunnerParams stateParams = createRecoverGrainRunnerParams(stackService.getByIdWithListsInTransaction(stackId), operation);
    LOGGER.debug("{} 'recover' role with params {}", operation.name().toLowerCase(), stateParams);
    hostOrchestrator.runOrchestratorGrainRunner(stateParams);
}
Also used : OrchestratorGrainRunnerParams(com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorGrainRunnerParams)

Example 3 with OrchestratorGrainRunnerParams

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

the class RdsRecoverySetupService method createOrchestratorGrainRunnerParams.

private OrchestratorGrainRunnerParams createOrchestratorGrainRunnerParams(Stack stack, Cluster cluster, Set<Node> nodes, GrainOperation grainOperation) {
    OrchestratorGrainRunnerParams grainRunnerParams = new OrchestratorGrainRunnerParams();
    InstanceMetaData gatewayInstance = stack.getPrimaryGatewayInstance();
    grainRunnerParams.setPrimaryGatewayConfig(gatewayConfigService.getGatewayConfig(stack, gatewayInstance, stack.getCluster().hasGateway()));
    Set<String> targetHostNames = gatewayInstance.getDiscoveryFQDN() != null ? Set.of(gatewayInstance.getDiscoveryFQDN()) : Set.of();
    grainRunnerParams.setTargetHostNames(targetHostNames);
    grainRunnerParams.setAllNodes(nodes);
    grainRunnerParams.setExitCriteriaModel(ClusterDeletionBasedExitCriteriaModel.clusterDeletionBasedModel(stack.getId(), cluster.getId()));
    grainRunnerParams.setKey(ROLES);
    grainRunnerParams.setValue(RECOVER);
    grainRunnerParams.setGrainOperation(grainOperation);
    return grainRunnerParams;
}
Also used : InstanceMetaData(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData) OrchestratorGrainRunnerParams(com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorGrainRunnerParams)

Example 4 with OrchestratorGrainRunnerParams

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

the class RdsRecoverySetupServiceTest method testRunRecoverState.

@Test
public void testRunRecoverState() throws CloudbreakOrchestratorFailedException {
    ReflectionTestUtils.setField(postgresConfigService, "databasesReusedDuringRecovery", List.of("HIVE"));
    Stack stack = TestUtil.stack(TestUtil.cluster());
    Long stackId = stack.getId();
    Node node1 = new Node("", "", "", "", "node1fqdn", "");
    Node node2 = new Node("", "", "", "", "node2fqdn", "");
    when(gatewayConfigService.getGatewayConfig(any(Stack.class), any(InstanceMetaData.class), anyBoolean())).thenReturn(gatewayConfig);
    when(stackService.getByIdWithListsInTransaction(stackId)).thenReturn(stack);
    when(stackUtil.collectReachableNodes(stack)).thenReturn(Set.of(node1, node2));
    ArgumentCaptor<OrchestratorGrainRunnerParams> grainRunnerParamsArgumentCaptor = ArgumentCaptor.forClass(OrchestratorGrainRunnerParams.class);
    underTest.addRecoverRole(stackId);
    verify(hostOrchestrator).runOrchestratorGrainRunner(grainRunnerParamsArgumentCaptor.capture());
    OrchestratorGrainRunnerParams grainRunnerParams = grainRunnerParamsArgumentCaptor.getValue();
    assertEquals(Set.of("test-is1-1-1"), grainRunnerParams.getTargetHostNames());
    assertEquals(Set.of(node1, node2), grainRunnerParams.getAllNodes());
    assertEquals(gatewayConfig, grainRunnerParams.getPrimaryGatewayConfig());
    assertEquals("roles", grainRunnerParams.getKey());
    assertEquals("recover", grainRunnerParams.getValue());
}
Also used : InstanceMetaData(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData) OrchestratorGrainRunnerParams(com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorGrainRunnerParams) Node(com.sequenceiq.cloudbreak.common.orchestration.Node) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.jupiter.api.Test)

Example 5 with OrchestratorGrainRunnerParams

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

the class ClusterHostServiceRunner method modifyStartupMountRole.

private void modifyStartupMountRole(Stack stack, Set<Node> nodes, GrainOperation operation) throws CloudbreakOrchestratorFailedException {
    OrchestratorGrainRunnerParams stateParams = createStartupMountGrainRunnerParams(stack, nodes, operation);
    LOGGER.debug("{} 'startup' role with params {}", operation.name().toLowerCase(), stateParams);
    hostOrchestrator.runOrchestratorGrainRunner(stateParams);
}
Also used : OrchestratorGrainRunnerParams(com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorGrainRunnerParams)

Aggregations

OrchestratorGrainRunnerParams (com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorGrainRunnerParams)5 InstanceMetaData (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData)3 Node (com.sequenceiq.cloudbreak.common.orchestration.Node)1 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)1 Test (org.junit.jupiter.api.Test)1