blob: 80c8acd4955f698571f62251ae0667523f6fa941 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.provision.provisioning;
import com.yahoo.config.provision.CloudAccount;
import com.yahoo.config.provision.Flavor;
import com.yahoo.config.provision.NodeResources;
import com.yahoo.config.provision.NodeType;
import com.yahoo.vespa.hosted.provision.NodeRepository;
import com.yahoo.vespa.hosted.provision.Nodelike;
import java.util.Optional;
/**
* Some cloud providers advertise that a certain amount of resources are available in a flavor
* but then actually provide less.
*
* This class converts between real and advertised resources for all clouds.
*
* @author freva
* @author bratseth
*/
public interface HostResourcesCalculator {
/** Returns the real resources available on a node */
NodeResources realResourcesOf(Nodelike node, NodeRepository nodeRepository);
/** Returns the advertised resources of a flavor */
NodeResources advertisedResourcesOf(Flavor flavor);
/**
* Used with exclusive hosts:
* Returns the lowest possible real resources we'll get if requesting the given advertised resources
*/
NodeResources requestToReal(NodeResources advertisedResources, Optional<CloudAccount> enclaveAccount,
boolean exclusiveAllocation, boolean bestCase);
/**
* Used with shared hosts:
* Returns the advertised resources we need to request to be sure to get at least the given real resources.
*/
NodeResources realToRequest(NodeResources realResources, Optional<CloudAccount> enclaveAccount, boolean exclusiveAllocation, boolean bestCase);
/**
* Returns the disk space to reserve in base2 GB. This space is reserved for use by the host, e.g. for storing
* container images.
*/
long reservedDiskSpaceInBase2Gb(NodeType nodeType, boolean sharedHost);
}
|