@JsonValue @Override public String toString() { return asString(); }
private static int compareNodeGroupsForSuspend(NodeGroup leftNodeGroup, NodeGroup rightNodeGroup) { ApplicationInstanceReference leftApplicationReference = leftNodeGroup.getApplicationReference(); ApplicationInstanceReference rightApplicationReference = rightNodeGroup.getApplicationReference(); // ApplicationInstanceReference.toString() is e.g. "hosted-vespa:routing:dev:some-region:default" return leftApplicationReference.asString().compareTo(rightApplicationReference.asString()); }
@Override public void setApplicationInstanceStatus(ApplicationInstanceStatus applicationInstanceStatus) { if (probe) return; log.log(LogLevel.INFO, "Setting app " + applicationInstanceReference.asString() + " to status " + applicationInstanceStatus); String path = applicationInstanceSuspendedPath(applicationInstanceReference); try { switch (applicationInstanceStatus) { case NO_REMARKS: deleteNode_ignoreNoNodeException(path, "Instance is already in state NO_REMARKS, path = " + path); break; case ALLOWED_TO_BE_DOWN: createNode_ignoreNodeExistsException(path, "Instance is already in state ALLOWED_TO_BE_DOWN, path = " + path); break; } } catch (Exception e) { throw new RuntimeException(e); } }
public static ApplicationId toApplicationId(ApplicationInstanceReference appRef) { String appNameStr = appRef.asString(); String[] appNameParts = appNameStr.split(":"); // Env, region and instance seems to be optional due to the hardcoded config server app // Assume here that first two are tenant and application name. if (appNameParts.length == 2) { return ApplicationId.from(TenantName.from(appNameParts[0]), ApplicationName.from(appNameParts[1]), InstanceName.defaultName()); } // Other normal application should have 5 parts. if (appNameParts.length != 5) { throw new IllegalArgumentException("Application reference not valid (not 5 parts): " + appRef); } return ApplicationId.from(TenantName.from(appNameParts[0]), ApplicationName.from(appNameParts[1]), InstanceName.from(appNameParts[4])); }
@Override public GetHostResponse getHost(String hostNameString) { HostName hostName = new HostName(hostNameString); try { Host host = orchestrator.getHost(hostName); URI applicationUri = uriInfo.getBaseUriBuilder() .path(InstanceResource.class) .path(host.getApplicationInstanceReference().asString()) .build(); List<HostService> hostServices = host.getServiceInstances().stream() .map(serviceInstance -> new HostService( serviceInstance.getServiceCluster().clusterId().s(), serviceInstance.getServiceCluster().serviceType().s(), serviceInstance.configId().s(), serviceInstance.serviceStatus().name())) .collect(Collectors.toList()); return new GetHostResponse( host.getHostName().s(), host.getHostStatus().name(), applicationUri.toString(), hostServices); } catch (UncheckedTimeoutException e) { log.log(LogLevel.INFO, "Failed to get host " + hostName + ": " + e.getMessage()); throw webExceptionFromTimeout("getHost", hostName, e); } catch (HostNameNotFoundException e) { log.log(LogLevel.INFO, "Host not found: " + hostName); throw new NotFoundException(e); } }
"application " + applicationInstance.reference().asString() + ", host " + hostName() + ", cluster name " + clusterId + " has been set to " + wantedNodeState; logger.log(LogLevel.INFO, "Storage node " + nodeIndex + " in cluster " + clusterId + " application " + applicationInstance.reference().asString() + " on host " + hostName() + logSuffix);