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;
}
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);
}
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;
}
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());
}
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);
}
Aggregations