@Override public ServiceType serviceType() { return serviceCluster.serviceType(); }
/** * @return true iff the service cluster is a content service cluster. */ public static boolean isContent(ServiceCluster cluster) { return DISTRIBUTOR_SERVICE_TYPE.equals(cluster.serviceType()) || SEARCHNODE_SERVICE_TYPE.equals(cluster.serviceType()) || STORAGENODE_SERVICE_TYPE.equals(cluster.serviceType()); }
/** * Note that a search node service cluster (service type searchnode aka proton) is * always accompanied by a storage node service cluster, but not vice versa. * * @return true iff the service cluster consists of storage nodes (proton or vds). */ public static boolean isStorage(ServiceCluster cluster) { return STORAGENODE_SERVICE_TYPE.equals(cluster.serviceType()); }
public static boolean isClusterController(ServiceCluster cluster) { return CLUSTER_CONTROLLER_SERVICE_TYPE.equals(cluster.serviceType()); }
public static int getSuspendPercentageAllowed(ServiceCluster serviceCluster) { if (VespaModelUtil.ADMIN_CLUSTER_ID.equals(serviceCluster.clusterId())) { if (VespaModelUtil.SLOBROK_SERVICE_TYPE.equals(serviceCluster.serviceType())) { return SUSPENSION_ALLOW_MINIMAL; } return SUSPENSION_ALLOW_ALL; } if (VespaModelUtil.isStorage(serviceCluster)) { return SUSPENSION_ALLOW_MINIMAL; } return SUSPENSION_ALLOW_TEN_PERCENT; }
@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); } }