private void validateConnection(ContainerHostSpec hostSpec, Operation op) { EndpointCertificateUtil.validateSslTrust(this, hostSpec, op, () -> { fetchSslTrustAliasProperty(hostSpec, () -> { pingHost(hostSpec, op, hostSpec.sslTrust, () -> completeOperationSuccess(op)); }); }); }
private void validateVicHost(ContainerHostSpec hostSpec, Operation op) { String computeAddress = hostSpec.hostState.address; EndpointCertificateUtil.validateSslTrust(this, hostSpec, op, () -> { fetchSslTrustAliasProperty(hostSpec, () -> { getHostInfo(hostSpec, op, hostSpec.sslTrust, (computeState) -> { if (ContainerHostUtil.isVicHost(computeState)) { logInfo("VIC host verification passed for %s", computeAddress); completeOperationSuccess(op); } else { logInfo("VIC host verification failed for %s", computeAddress); op.fail(new LocalizableValidationException( CONTAINER_HOST_IS_NOT_VCH_MESSAGE, CONTAINER_HOST_IS_NOT_VCH_MESSAGE_CODE)); } }); }); }); }
private void createHostPortProfile(ComputeState computeState, Operation operation) { HostPortProfileService.HostPortProfileState hostPortProfileState = new HostPortProfileService.HostPortProfileState(); hostPortProfileState.hostLink = computeState.documentSelfLink; // Make sure there is only one HostPortProfile per Host by generating profile id based on // host id hostPortProfileState.id = computeState.id; hostPortProfileState.documentSelfLink = HostPortProfileService.getHostPortProfileLink( computeState.documentSelfLink); // POST will be converted to PUT if profile with this id already exists sendRequest(OperationUtil .createForcedPost(this, HostPortProfileService.FACTORY_LINK) .setBody(hostPortProfileState) .setCompletion((o, ex) -> { if (ex != null) { operation.fail(ex); return; } HostPortProfileService.HostPortProfileState result = o.getBody( HostPortProfileService.HostPortProfileState.class); logInfo("Created HostPortProfile for host %s with port range %s-%s.", result.hostLink, result.startPort, result.endPort); completeOperationSuccess(operation); })); }