private boolean isAllocationOperation(RequestBrokerState state) { return isProvisionOperation(state) && Boolean.TRUE.toString() .equals(state.getCustomProperty(RequestUtils.FIELD_NAME_ALLOCATION_REQUEST)); }
private String getPostAllocationOperation(RequestBrokerState state) { if (!isProvisionOperation(state)) { // It's not a provision resource operation but other type of operation without a // post-allocation operation associated. return null; } if (state.customProperties != null && Boolean.parseBoolean( state.customProperties.get(FIELD_NAME_ALLOCATION_REQUEST))) { // It's a provision resource operation but the __allocation_request flag indicates that // only the allocation must happen so that skipping the post-allocation operation. return null; } if (isContainerNetworkType(state)) { return NetworkOperationType.CREATE.id; } else if (isContainerVolumeType(state)) { return VolumeOperationType.CREATE.id; } else if (isPKSClusterType(state)) { return PKSOperationType.CREATE_CLUSTER.id; } else { // No ContainerType here since its "unified" ContainerAllocationTaskService handles it! return null; } }
if (isProvisionOperation(state)) { boolean allocationOnly = isAllocationOperation(state); RequestType reqType = allocationOnly ? RequestType.ALLOCATION_ONLY
private void calculateActualRequestedResources(RequestBrokerState state, SubStage next) { if (isPKSClusterType(state)) { proceedTo(next, s -> { s.actualResourceCount = state.resourceCount; s.documentExpirationTimeMicros = getExpirationTimeFromNowInMicros( EXPIRATION_MICROS * 2); }); return; } if (isProvisionOperation(state)) { if (isContainerType(state)) { getContainerDescription(state, (cd) -> { proceedTo(next, s -> { s.actualResourceCount = getRequestContainerResourceCount(state, cd); updateRequestTrackerName(state, cd.name); }); }); } else { proceedTo(next, s -> s.actualResourceCount = state.resourceCount); } } else { proceedTo(next, s -> s.actualResourceCount = state.resourceCount); } }
@Override protected void validateStateOnStart(RequestBrokerState state) throws IllegalArgumentException { if (state.operation == null) { state.operation = RequestBrokerState.PROVISION_RESOURCE_OPERATION; } if (isProvisionOperation(state) || isClusteringOperation(state)) { if (!isPKSClusterType(state)) { assertNotEmpty(state.resourceDescriptionLink, "resourceDescriptionLink"); } } else { assertNotEmpty(state.resourceLinks, "resourceLinks"); } if (!(isContainerType(state) || isContainerHostType(state) || isContainerNetworkType(state) || isContainerVolumeType(state) || isComputeType(state) || isCompositeComponentType(state) || isClosureType(state) || isPKSClusterType(state))) { throw new LocalizableValidationException( String.format("Only [ %s ] resource types are supported.", ResourceType.getAllTypesAsString()), "request.supported.resource-types", ResourceType.getAllTypesAsString()); } if (state.resourceCount <= 0) { state.resourceCount = 1; } }
allocationTask.resourceDescriptionLink = state.resourceDescriptionLink; if (isProvisionOperation(state) && !isClusteringOperation(state)) {
break; case RESOURCE_COUNTED: if (isProvisionOperation(state)) { if (isCompositeComponentType(state)) { createCompositionTask(state); if (isProvisionOperation(state)) { createReservationRemovalTask(state); } else if (isPostAllocationOperation(state)) {