diff options
Diffstat (limited to 'config-model/src/main/java/com/yahoo/vespa/model/HostResource.java')
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/HostResource.java | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/HostResource.java b/config-model/src/main/java/com/yahoo/vespa/model/HostResource.java index aa59f9434f0..a712d5d8e69 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/HostResource.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/HostResource.java @@ -6,6 +6,7 @@ import com.yahoo.config.application.api.DeployLogger; import com.yahoo.config.model.api.HostInfo; import com.yahoo.config.provision.ClusterMembership; import com.yahoo.config.provision.Flavor; +import com.yahoo.config.provision.NodeResources; import java.util.ArrayList; import java.util.Collection; @@ -38,8 +39,9 @@ public class HostResource implements Comparable<HostResource> { private Set<ClusterMembership> clusterMemberships = new LinkedHashSet<>(); - // Empty for self-hosted Vespa. + // Empty for self-hosted private Optional<Flavor> flavor = Optional.empty(); + private Optional<NodeResources> requestedResources = Optional.empty(); /** The current Vespa version running on this node, or empty if not known */ private final Optional<Version> version; @@ -61,6 +63,7 @@ public class HostResource implements Comparable<HostResource> { /** * Return the currently bounded {@link com.yahoo.vespa.model.Host}. + * * @return the {@link com.yahoo.vespa.model.Host} if bound, null if not. */ public Host getHost() { return host; } @@ -71,9 +74,9 @@ public class HostResource implements Comparable<HostResource> { /** * Adds service and allocates resources for it. * - * @param service The Service to allocate resources for + * @param service the Service to allocate resources for * @param wantedPort the wanted port for this service - * @return The allocated ports for the Service. + * @return the allocated ports for the Service. */ List<Integer> allocateService(DeployLogger deployLogger, AbstractService service, int wantedPort) { ports().useLogger(deployLogger); @@ -91,16 +94,13 @@ public class HostResource implements Comparable<HostResource> { * or null if the name does not match any service. * * @param sentinelName the sentinel name of the service we want to return - * @return The service with the given sentinel name + * @return the service with the given sentinel name */ public Service getService(String sentinelName) { return services.get(sentinelName); } - /** - * Returns a List of all services running on this Host. - * @return a List of all services running on this Host. - */ + /** Returns a List of all services running on this Host. */ public List<Service> getServices() { return new ArrayList<>(services.values()); } @@ -116,6 +116,13 @@ public class HostResource implements Comparable<HostResource> { /** Returns the flavor of this resource. Empty for self-hosted Vespa. */ public Optional<Flavor> getFlavor() { return flavor; } + public void setRequestedResources(NodeResources resources) { + this.requestedResources = Optional.of(resources); + } + + /** Returns the ressource requested which led to these host resources being allocated, if known */ + public Optional<NodeResources> getRequestedResources() { return requestedResources; } + public void addClusterMembership(ClusterMembership clusterMembership) { if (clusterMembership != null) clusterMemberships.add(clusterMembership); |