use of com.sequenceiq.cloudbreak.domain.HostGroup in project cloudbreak by hortonworks.
the class AmbariClusterUpscaleService method installServicesOnNewHosts.
public void installServicesOnNewHosts(Long stackId, String hostGroupName) throws CloudbreakException {
Stack stack = stackService.getByIdWithLists(stackId);
LOGGER.info("Start installing Ambari services");
HostGroup hostGroup = hostGroupService.getByClusterIdAndName(stack.getCluster().getId(), hostGroupName);
Set<HostMetadata> hostMetadata = hostGroupService.findEmptyHostMetadataInHostGroup(hostGroup.getId());
ambariClusterConnector.upscaleCluster(stack, hostGroup, hostMetadata);
}
use of com.sequenceiq.cloudbreak.domain.HostGroup in project cloudbreak by hortonworks.
the class StackService method validateHostGroupAdjustment.
private void validateHostGroupAdjustment(InstanceGroupAdjustmentJson instanceGroupAdjustmentJson, Stack stack, Integer adjustment) {
Blueprint blueprint = stack.getCluster().getBlueprint();
Optional<HostGroup> hostGroup = stack.getCluster().getHostGroups().stream().filter(input -> input.getConstraint().getInstanceGroup().getGroupName().equals(instanceGroupAdjustmentJson.getInstanceGroup())).findFirst();
if (!hostGroup.isPresent()) {
throw new BadRequestException(String.format("Instancegroup '%s' not found or not part of stack '%s'", instanceGroupAdjustmentJson.getInstanceGroup(), stack.getName()));
}
blueprintValidator.validateHostGroupScalingRequest(blueprint, hostGroup.get(), adjustment);
}
use of com.sequenceiq.cloudbreak.domain.HostGroup in project cloudbreak by hortonworks.
the class BlueprintValidator method validateHostGroup.
private void validateHostGroup(JsonNode hostGroupNode, Map<String, HostGroup> hostGroupMap, Map<String, BlueprintServiceComponent> blueprintServiceComponentMap) {
String hostGroupName = getHostGroupName(hostGroupNode);
HostGroup hostGroup = getHostGroup(hostGroupMap, hostGroupName);
JsonNode componentsNode = getComponentsNode(hostGroupNode);
for (JsonNode componentNode : componentsNode) {
validateComponent(componentNode, hostGroup, blueprintServiceComponentMap);
}
}
use of com.sequenceiq.cloudbreak.domain.HostGroup in project cloudbreak by hortonworks.
the class BlueprintValidator method validateHostGroupScalingRequest.
public void validateHostGroupScalingRequest(Blueprint blueprint, HostGroup hostGroup, Integer adjustment) {
try {
JsonNode hostGroupsNode = getHostGroupNode(blueprint);
Map<String, HostGroup> hostGroupMap = createHostGroupMap(Collections.singleton(hostGroup));
for (JsonNode hostGroupNode : hostGroupsNode) {
if (hostGroup.getName().equals(hostGroupNode.get("name").asText())) {
hostGroup.getConstraint().setHostCount(hostGroup.getConstraint().getHostCount() + adjustment);
try {
validateHostGroup(hostGroupNode, hostGroupMap, new HashMap<>());
} finally {
hostGroup.getConstraint().setHostCount(hostGroup.getConstraint().getHostCount() - adjustment);
}
break;
}
}
} catch (IOException ignored) {
throw new BlueprintValidationException(String.format("Blueprint [%s] can not be parsed from JSON.", blueprint.getId()));
}
}
use of com.sequenceiq.cloudbreak.domain.HostGroup in project cloudbreak by hortonworks.
the class HdfConfigProvider method createHdfConfig.
public HdfConfigs createHdfConfig(Set<HostGroup> hostgroups, Map<String, List<InstanceMetaData>> groupInstances, String blueprintText) {
BlueprintTextProcessor blueprintTextProcessor = createTextProcessor(blueprintText);
Set<String> nifiMasters = collectNifiMasters(blueprintText);
Set<InstanceGroup> nifiIgs = collectInstanceGroupsWhichContainsNifiMasters(hostgroups, nifiMasters);
List<String> nifiFqdns = collectFqdnsByInstanceGroupName(groupInstances, nifiIgs);
AtomicInteger index = new AtomicInteger(0);
String nodeIdentities = nifiFqdns.stream().map(fqdn -> String.format("<property name=\"Node Identity %s\">CN=%s, OU=NIFI</property>", index.addAndGet(1), fqdn)).collect(Collectors.joining());
return new HdfConfigs(nodeIdentities, getProxyHostsParameter(nifiIgs, blueprintTextProcessor, groupInstances));
}
Aggregations