private void postEventlogError(ComputeState hostState, String message) { EventLogState eventLog = new EventLogState(); eventLog.description = message == null ? "Unexpected error" : message; eventLog.eventLogType = EventLogType.ERROR; eventLog.resourceType = getClass().getName(); eventLog.tenantLinks = hostState.tenantLinks; sendRequest(Operation.createPost(this, EventLogService.FACTORY_LINK) .setBody(eventLog) .setCompletion((o, e) -> { if (e != null) { logWarning("Failed to create event log: %s", Utils.toString(e)); } })); }
private void updateContainerHostInfo(String documentSelfLink) { URI uri = UriUtils.buildUri(getHost(), ContainerHostDataCollectionService.HOST_INFO_DATA_COLLECTION_LINK); ContainerHostDataCollectionState state = new ContainerHostDataCollectionState(); state.createOrUpdateHost = true; state.computeContainerHostLinks = Collections.singleton(documentSelfLink); sendRequest(Operation.createPatch(uri) .setBody(state) .setCompletion((o, ex) -> { if (ex != null) { logWarning("Failed to update host data collection: %s", ex.getMessage()); } })); }
logWarning("Cannot connect to %s to get remote certificate for sslTrustAlias", hostSpec.uri); callback.run();
private void validateHostTypeAndConnection(ContainerHostSpec hostSpec, Operation op) { ContainerHostType hostType; try { hostType = ContainerHostUtil.getDeclaredContainerHostType(hostSpec.hostState); } catch (LocalizableValidationException ex) { logWarning("Error getting host type: %s", ex.getMessage()); op.fail(ex); return; } // Apply the appropriate validation for each host type switch (hostType) { case DOCKER: validateConnection(hostSpec, op); break; case VCH: validateVicHost(hostSpec, op); break; case KUBERNETES: validateConnection(hostSpec, op); break; default: String error = String.format( ContainerHostUtil.CONTAINER_HOST_TYPE_NOT_SUPPORTED_MESSAGE_FORMAT, hostType.toString()); op.fail(new LocalizableValidationException(error, ContainerHostUtil.CONTAINER_HOST_TYPE_NOT_SUPPORTED_MESSAGE_CODE, hostType)); break; } }
.setCompletion((o, e) -> { if (e != null) { logWarning("Default host description can't be created." + " Exception: %s", e instanceof CancellationException
Throwable cause = ex instanceof CompletionException ? ex.getCause() : ex; logWarning("Unsupported VCH version: %s", Utils.toString(cause)); op.fail(cause);
op); logWarning("Error sending adapter request with type %s : %s. Cause: %s", request.operationTypeId, rsp.message, Utils.toString(ex)); postEventlogError(cs, rsp.message);
.getDeclaredContainerHostType(hostSpec.hostState); } catch (LocalizableValidationException ex) { logWarning("Error getting host type: %s", ex.getMessage()); op.fail(ex); return;