use of com.sequenceiq.cloudbreak.domain.stack.Stack in project cloudbreak by hortonworks.
the class StackCreationService method startProvisioning.
public void startProvisioning(StackContext context, Map<Object, Object> variables) {
Stack stack = context.getStack();
if (variables.containsKey(IMAGE_COPY_START_MILLIS)) {
long startMillis = (long) variables.get(IMAGE_COPY_START_MILLIS);
metricService.recordImageCopyTime(stack, startMillis);
}
stackUpdater.updateStackStatus(stack.getId(), DetailedStackStatus.CREATING_INFRASTRUCTURE, "Creating infrastructure");
flowMessageService.fireEventAndLog(stack.getId(), CREATE_IN_PROGRESS.name(), STACK_PROVISIONING);
instanceMetaDataService.saveInstanceRequests(stack, context.getCloudStack().getGroups());
}
use of com.sequenceiq.cloudbreak.domain.stack.Stack in project cloudbreak by hortonworks.
the class StackCreationService method saveTlsInfo.
public Stack saveTlsInfo(StackContext context, TlsInfo tlsInfo) {
boolean usePrivateIpToTls = tlsInfo.usePrivateIpToTls();
Stack stack = context.getStack();
if (usePrivateIpToTls) {
SecurityConfig securityConfig = stack.getSecurityConfig();
securityConfig.setUsePrivateIpToTls(true);
stackUpdater.updateStackSecurityConfig(stack, securityConfig);
stack = stackService.getByIdWithListsInTransaction(stack.getId());
stack.setResources(new HashSet<>(resourceService.getAllByStackId(stack.getId())));
LOGGER.debug("Update Stack and it's SecurityConfig to use private ip when TLS is built.");
}
return stack;
}
use of com.sequenceiq.cloudbreak.domain.stack.Stack in project cloudbreak by hortonworks.
the class StackCreationService method handleFailure.
private void handleFailure(StackView stackView, String errorReason) {
Stack stack = stackService.getByIdWithListsInTransaction(stackView.getId());
handleFailure(stack, errorReason);
}
use of com.sequenceiq.cloudbreak.domain.stack.Stack in project cloudbreak by hortonworks.
the class StackCreationService method loadBalancerProvisioningFinished.
public Stack loadBalancerProvisioningFinished(StackContext context, LaunchLoadBalancerResult result, Map<Object, Object> variables) {
Stack stack = context.getStack();
validateResourceResults(context.getCloudContext(), result);
stackUpdater.updateStackStatus(stack.getId(), DetailedStackStatus.METADATA_COLLECTION, "Metadata collection");
Stack provisionedStack = stackService.getByIdWithListsInTransaction(stack.getId());
provisionedStack.setResources(new HashSet<>(resourceService.getAllByStackId(stack.getId())));
return provisionedStack;
}
use of com.sequenceiq.cloudbreak.domain.stack.Stack in project cloudbreak by hortonworks.
the class StackCreationService method setInstanceStoreCount.
public void setInstanceStoreCount(StackContext stackContext) {
Stack stack = stackContext.getStack();
CloudConnector<Object> connector = cloudPlatformConnectors.get(stackContext.getCloudContext().getPlatformVariant());
AuthenticatedContext ac = connector.authentication().authenticate(stackContext.getCloudContext(), stackContext.getCloudCredential());
List<String> instanceTypes = stack.getInstanceGroups().stream().map(InstanceGroup::getTemplate).filter(Objects::nonNull).map(Template::getInstanceType).filter(Objects::nonNull).collect(Collectors.toList());
InstanceStoreMetadata instanceStoreMetadata = connector.metadata().collectInstanceStorageCount(ac, instanceTypes);
for (InstanceGroup ig : stack.getInstanceGroups()) {
Template template = ig.getTemplate();
if (template != null) {
Integer instanceStorageCount = instanceStoreMetadata.mapInstanceTypeToInstanceStoreCountNullHandled(template.getInstanceType());
if (ephemeralVolumeChecker.instanceGroupContainsOnlyDatabaseAndEphemeralVolumes(ig)) {
LOGGER.debug("Instance storage was already requested. Setting temporary storage in template to: {}. " + "Group name: {}, Template id: {}, instance type: {}", TemporaryStorage.EPHEMERAL_VOLUMES_ONLY.name(), ig.getGroupName(), template.getId(), template.getInstanceType());
template.setTemporaryStorage(TemporaryStorage.EPHEMERAL_VOLUMES_ONLY);
} else if (instanceStorageCount > 0 && stack.getType().equals(StackType.WORKLOAD)) {
LOGGER.debug("The host group's instance type has ephemeral volumes. Setting temporary storage in template to: {}. " + "Group name: {}, Template id: {}, instance type: {}", TemporaryStorage.EPHEMERAL_VOLUMES.name(), ig.getGroupName(), template.getId(), template.getInstanceType());
template.setTemporaryStorage(TemporaryStorage.EPHEMERAL_VOLUMES);
}
LOGGER.debug("Setting instance storage count in template. " + "Group name: {}, Template id: {}, instance type: {}", ig.getGroupName(), template.getId(), template.getInstanceType());
template.setInstanceStorageCount(instanceStorageCount);
templateService.savePure(template);
}
}
}
Aggregations