private void validateConnection(ContainerHostSpec hostSpec, Operation op) { EndpointCertificateUtil.validateSslTrust(this, hostSpec, op, () -> { fetchSslTrustAliasProperty(hostSpec, () -> { pingHost(hostSpec, op, hostSpec.sslTrust, () -> completeOperationSuccess(op)); }); }); }
private void triggerDependentUpdates(String resourcePoolLink) { EpzComputeEnumerationTaskService.triggerForResourcePool(this, resourcePoolLink); PlacementCapacityUpdateTaskService.triggerForResourcePool(this, resourcePoolLink); }
/** * Check if this host should be treated as scheduler host. Note that a host may be a scheduler * (e.g. VIC, Kubernetes) but it may be declared as plain docker host and in this case the host * should be treated as a plain docker host * * @param computeState * @return boolean value */ public static boolean isTreatedLikeSchedulerHost(ComputeState computeState) { return getDeclaredContainerHostType(computeState) != ContainerHostType.DOCKER; }
/** * Check if this host is a scheduler host (e.g. VIC, Kubernetes) * * @param computeState * @return boolean value */ public static boolean isSchedulerHost(ComputeState computeState) { return ContainerHostUtil.isVicHost(computeState) || ContainerHostUtil.isKubernetesHost(computeState); }
static ContainerHostSpec createContainerHostSpec(List<String> tenantLinks, String computeDescriptionId) throws Throwable { ContainerHostSpec ch = new ContainerHostSpec(); ch.hostState = createComputeHost(tenantLinks, computeDescriptionId); return ch; }
private ElasticPlacementZoneState createEpz(String rpLink, String... tagLinks) throws Throwable { ElasticPlacementZoneState initialState = new ElasticPlacementZoneState(); initialState.resourcePoolLink = rpLink; initialState.tagLinksToMatch = tagSet(tagLinks); return doPost(initialState, ElasticPlacementZoneService.FACTORY_LINK); }
private ElasticPlacementZoneState patchEpz(String epzLink, String... tagLinksToAdd) throws Throwable { ElasticPlacementZoneState patchState = new ElasticPlacementZoneState(); patchState.tagLinksToMatch = tagSet(tagLinksToAdd); return doPatch(patchState, epzLink); }
private ElasticPlacementZoneState buildEpzState(String rpLink, String... tagLinks) { ElasticPlacementZoneState state = new ElasticPlacementZoneState(); state.resourcePoolLink = rpLink; state.tagLinksToMatch = tagSet(tagLinks); return state; }
private String startTask(String resourcePoolLink) throws Throwable { EpzComputeEnumerationTaskState initialState = new EpzComputeEnumerationTaskState(); initialState.resourcePoolLink = resourcePoolLink; EpzComputeEnumerationTaskState returnState = doOperation(initialState, UriUtils.buildUri(this.host, EpzComputeEnumerationTaskService.FACTORY_LINK), EpzComputeEnumerationTaskState.class, false, Action.POST); return returnState.documentSelfLink; } }
private void storeDockerHost(ContainerHostSpec hostSpec, Operation op) { if (hostSpec.acceptHostAddress) { doStoreHost(hostSpec, op); } else { // Docker hosts are validated by a ping call. pingHost(hostSpec, op, hostSpec.sslTrust, () -> { doStoreHost(hostSpec, op); }); } }
private void getHostInfo(ContainerHostSpec hostSpec, Operation op, SslTrustCertificateState sslTrust, Consumer<ComputeState> callbackFunction) { ComputeState cs = hostSpec.hostState; AdapterRequest request = prepareAdapterRequest(ContainerHostOperationType.INFO, cs, sslTrust); sendAdapterRequest(request, cs, op, callbackFunction, ComputeState.class); }
@Override public void handlePost(Operation post) { ElasticPlacementZoneConfigurationState state = validateState(post); doCreate(post, state); }
@Override public void handlePatch(Operation patch) { ElasticPlacementZoneConfigurationState state = validateState(patch); doUpdate(patch, state); }
private void createHost(RegistryHostSpec hostSpec, Operation op) { if (hostSpec.acceptHostAddress) { storeHost(hostSpec, op); } else { validateConnection( hostSpec, op, true); } }
public boolean isProvisioningTimeBinding() { return (this.placeholder != null) && BindingUtils.isProvisioningTimeBinding(this.placeholder.bindingExpression); } }
private ComputeStats getComputeHostStats(ComputeState compute, ComputeDescription description) { ComputeStats stats = new ComputeStats(); stats.totalMemoryBytes = description.totalMemoryBytes; stats.cpuCoreCount = description.cpuCount; stats.cpuMhzPerCore = description.cpuMhzPerCore; // TODO pmitrov: populate usage figures stats.availableMemoryBytes = stats.totalMemoryBytes; stats.cpuUsage = 0.0; return stats; }
private static String retrieveLink(ResourceState state) { if (state instanceof Composable) { return ((Composable) state).retrieveCompositeComponentLink(); } return Composable.retrieveCompositeComponentLink(state); }
public static DeferredResult<ResourcePoolState> generatePlacementZone(ServiceHost serviceHost, ComputeState hostState) { return generatePlacementZone(serviceHost, hostState, null, null, null); }
private void storeKubernetesHost(ContainerHostSpec hostSpec, Operation op) { if (hostSpec.acceptHostAddress) { doStoreHost(hostSpec, op); } else { // Kubernetes hosts are validated by a ping call. pingHost(hostSpec, op, hostSpec.sslTrust, () -> { doStoreHost(hostSpec, op); }); } }
private void pingHost(ContainerHostSpec hostSpec, Operation op, SslTrustCertificateState sslTrust, Runnable callbackFunction) { ComputeState cs = hostSpec.hostState; AdapterRequest request = prepareAdapterRequest(ContainerHostOperationType.PING, cs, sslTrust); sendAdapterRequest(request, cs, op, callbackFunction); }