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