Search in sources :

Example 11 with InstanceGroupV2Request

use of com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request in project cloudbreak by hortonworks.

the class StackV2RequestToStackRequestConverter method convertClusterRequest.

private void convertClusterRequest(StackV2Request source, StackRequest stackRequest) {
    if (source.getCluster() != null) {
        stackRequest.setClusterRequest(conversionService.convert(source.getCluster(), ClusterRequest.class));
        for (InstanceGroupV2Request instanceGroupV2Request : source.getInstanceGroups()) {
            HostGroupRequest convert = conversionService.convert(instanceGroupV2Request, HostGroupRequest.class);
            stackRequest.getClusterRequest().getHostGroups().add(convert);
        }
        stackRequest.getClusterRequest().setName(source.getGeneral().getName());
    }
}
Also used : InstanceGroupV2Request(com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request) ClusterRequest(com.sequenceiq.cloudbreak.api.model.ClusterRequest) HostGroupRequest(com.sequenceiq.cloudbreak.api.model.HostGroupRequest)

Example 12 with InstanceGroupV2Request

use of com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request in project cloudbreak by hortonworks.

the class UpdateAmbariRequestToUpdateClusterRequestConverter method convert.

@Override
public UpdateClusterJson convert(ReinstallRequestV2 source) {
    UpdateClusterJson updateStackJson = new UpdateClusterJson();
    updateStackJson.setValidateBlueprint(true);
    updateStackJson.setKerberosPassword(source.getKerberosPassword());
    updateStackJson.setKerberosPrincipal(source.getKerberosPrincipal());
    Blueprint blueprint = blueprintRepository.findOneByName(source.getBlueprintName(), source.getAccount());
    if (blueprint != null) {
        updateStackJson.setBlueprintId(blueprint.getId());
        updateStackJson.setAmbariStackDetails(source.getAmbariStackDetails());
        Set<HostGroupRequest> hostgroups = new HashSet<>();
        for (InstanceGroupV2Request instanceGroupV2Request : source.getInstanceGroups()) {
            HostGroupRequest hostGroupRequest = new HostGroupRequest();
            hostGroupRequest.setRecoveryMode(instanceGroupV2Request.getRecoveryMode());
            hostGroupRequest.setRecipeNames(instanceGroupV2Request.getRecipeNames());
            hostGroupRequest.setName(instanceGroupV2Request.getGroup());
            ConstraintJson constraintJson = new ConstraintJson();
            constraintJson.setHostCount(instanceGroupV2Request.getNodeCount());
            constraintJson.setInstanceGroupName(instanceGroupV2Request.getGroup());
            hostGroupRequest.setConstraint(constraintJson);
            hostgroups.add(hostGroupRequest);
        }
        updateStackJson.setHostgroups(hostgroups);
    } else {
        throw new BadRequestException(String.format("Blueprint '%s' not available", source.getBlueprintName()));
    }
    return updateStackJson;
}
Also used : InstanceGroupV2Request(com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) HostGroupRequest(com.sequenceiq.cloudbreak.api.model.HostGroupRequest) BadRequestException(com.sequenceiq.cloudbreak.controller.BadRequestException) ConstraintJson(com.sequenceiq.cloudbreak.api.model.ConstraintJson) UpdateClusterJson(com.sequenceiq.cloudbreak.api.model.UpdateClusterJson) HashSet(java.util.HashSet)

Example 13 with InstanceGroupV2Request

use of com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request in project cloudbreak by hortonworks.

the class InstanceGroupToInstanceGroupV2RequestConverter method convert.

@Override
public InstanceGroupV2Request convert(InstanceGroup source) {
    InstanceGroupV2Request instanceGroupV2Request = new InstanceGroupV2Request();
    instanceGroupV2Request.setParameters(source.getAttributes().getMap());
    instanceGroupV2Request.setGroup(source.getGroupName());
    instanceGroupV2Request.setNodeCount(source.getNodeCount());
    instanceGroupV2Request.setType(source.getInstanceGroupType());
    instanceGroupV2Request.setRecipeNames(new HashSet<>());
    instanceGroupV2Request.setTemplate(getConversionService().convert(source.getTemplate(), TemplateV2Request.class));
    instanceGroupV2Request.setSecurityGroup(getConversionService().convert(source.getSecurityGroup(), SecurityGroupV2Request.class));
    return instanceGroupV2Request;
}
Also used : InstanceGroupV2Request(com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request) SecurityGroupV2Request(com.sequenceiq.cloudbreak.api.model.v2.SecurityGroupV2Request) TemplateV2Request(com.sequenceiq.cloudbreak.api.model.v2.TemplateV2Request)

Example 14 with InstanceGroupV2Request

use of com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request in project cloudbreak by hortonworks.

the class GeneralClusterConfigsProvider method generalClusterConfigs.

public GeneralClusterConfigs generalClusterConfigs(StackV2Request stack, IdentityUser identityUser) {
    boolean gatewayInstanceMetadataPresented = false;
    boolean instanceMetadataPresented = false;
    int nodeCount = 0;
    for (InstanceGroupV2Request instanceGroupV2Request : stack.getInstanceGroups()) {
        nodeCount += instanceGroupV2Request.getNodeCount();
    }
    GeneralClusterConfigs generalClusterConfigs = new GeneralClusterConfigs();
    generalClusterConfigs.setIdentityUserEmail(identityUser.getUsername());
    generalClusterConfigs.setAmbariIp("pendign...");
    generalClusterConfigs.setInstanceGroupsPresented(instanceMetadataPresented);
    generalClusterConfigs.setPassword(stack.getCluster().getAmbari().getPassword());
    generalClusterConfigs.setGatewayInstanceMetadataPresented(gatewayInstanceMetadataPresented);
    generalClusterConfigs.setClusterName(stack.getGeneral().getName());
    generalClusterConfigs.setExecutorType(stack.getCluster().getExecutorType());
    generalClusterConfigs.setStackName(stack.getGeneral().getName());
    generalClusterConfigs.setUuid("pending...");
    generalClusterConfigs.setUserName(stack.getCluster().getAmbari().getUserName());
    generalClusterConfigs.setNodeCount(nodeCount);
    generalClusterConfigs.setPrimaryGatewayInstanceDiscoveryFQDN(Optional.ofNullable("pending..."));
    return generalClusterConfigs;
}
Also used : InstanceGroupV2Request(com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request) GeneralClusterConfigs(com.sequenceiq.cloudbreak.blueprint.templates.GeneralClusterConfigs)

Example 15 with InstanceGroupV2Request

use of com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request in project cloudbreak by hortonworks.

the class MockInstanceTerminationReplicationTest method configMockServer.

@BeforeClass
@Parameters({ "mockPort", "sshPort" })
public void configMockServer(@Optional("9443") int mockPort, @Optional("2020") int sshPort) {
    IntegrationTestContext itContext = getItContext();
    Map<String, InstanceGroupV2Request> instanceGroupV2RequestMap = itContext.getContextParam(CloudbreakV2Constants.INSTANCEGROUP_MAP, Map.class);
    String stackName = itContext.getContextParam(CloudbreakV2Constants.STACK_NAME);
    int numberOfServers = 0;
    for (InstanceGroupV2Request igr : instanceGroupV2RequestMap.values()) {
        numberOfServers += igr.getNodeCount();
    }
    InstanceTerminationReplicationMock instanceTerminationMock = (InstanceTerminationReplicationMock) applicationContext.getBean(InstanceTerminationReplicationMock.NAME, mockPort, sshPort, numberOfServers);
    instanceTerminationMock.addAmbariMappings(stackName);
    instanceTerminationMock.addMockEndpoints();
    itContext.putContextParam(CloudbreakV2Constants.MOCK_SERVER, instanceTerminationMock);
    itContext.putContextParam(CloudbreakITContextConstants.MOCK_INSTANCE_MAP, instanceTerminationMock.getInstanceMap());
}
Also used : IntegrationTestContext(com.sequenceiq.it.IntegrationTestContext) InstanceGroupV2Request(com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request) BeforeClass(org.testng.annotations.BeforeClass) Parameters(org.testng.annotations.Parameters)

Aggregations

InstanceGroupV2Request (com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request)22 SecurityGroupV2Request (com.sequenceiq.cloudbreak.api.model.v2.SecurityGroupV2Request)9 IntegrationTestContext (com.sequenceiq.it.IntegrationTestContext)9 Parameters (org.testng.annotations.Parameters)9 BeforeClass (org.testng.annotations.BeforeClass)5 BeforeMethod (org.testng.annotations.BeforeMethod)4 TemplateV2Request (com.sequenceiq.cloudbreak.api.model.v2.TemplateV2Request)3 HostGroupRequest (com.sequenceiq.cloudbreak.api.model.HostGroupRequest)2 StackV2Request (com.sequenceiq.cloudbreak.api.model.v2.StackV2Request)2 ClusterRequest (com.sequenceiq.cloudbreak.api.model.ClusterRequest)1 ConstraintJson (com.sequenceiq.cloudbreak.api.model.ConstraintJson)1 InstanceGroupRequest (com.sequenceiq.cloudbreak.api.model.InstanceGroupRequest)1 NetworkRequest (com.sequenceiq.cloudbreak.api.model.NetworkRequest)1 OrchestratorRequest (com.sequenceiq.cloudbreak.api.model.OrchestratorRequest)1 SecurityRuleRequest (com.sequenceiq.cloudbreak.api.model.SecurityRuleRequest)1 StackAuthenticationRequest (com.sequenceiq.cloudbreak.api.model.StackAuthenticationRequest)1 StackRequest (com.sequenceiq.cloudbreak.api.model.StackRequest)1 UpdateClusterJson (com.sequenceiq.cloudbreak.api.model.UpdateClusterJson)1 ClusterV2Request (com.sequenceiq.cloudbreak.api.model.v2.ClusterV2Request)1 GeneralSettings (com.sequenceiq.cloudbreak.api.model.v2.GeneralSettings)1