diff options
-rw-r--r-- | docker-api/src/main/java/com/yahoo/vespa/hosted/dockerapi/ContainerResources.java | 17 | ||||
-rw-r--r-- | node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java | 2 |
2 files changed, 10 insertions, 9 deletions
diff --git a/docker-api/src/main/java/com/yahoo/vespa/hosted/dockerapi/ContainerResources.java b/docker-api/src/main/java/com/yahoo/vespa/hosted/dockerapi/ContainerResources.java index 1b0b6380481..c3c4ca19555 100644 --- a/docker-api/src/main/java/com/yahoo/vespa/hosted/dockerapi/ContainerResources.java +++ b/docker-api/src/main/java/com/yahoo/vespa/hosted/dockerapi/ContainerResources.java @@ -44,16 +44,17 @@ public class ContainerResources { /** * Create container resources from required fields. * - * @param cpus the amount of vcpu that should be exclusively available to this container. This is a hard limit: - * More than this amlunt will never be available. To allow an unlimited amount use 0. - * @param cpuCores the amount of vcpu that should ideally be allocated to this container if there are no other - * constraints on resources. To allow an unlimited amount use 0. - * @param memoryGb the exact amount of memory that must be available to this container. + * @param maxVcpu the amount of vcpu that allocation policies should allocate exclusively to this container. + * This is a hard upper limit. To allow an unlimited amount use 0. + * @param minVcpu the minimal amount of vcpu dedicated to this container. + * To avoid dedicating any cpu at all, use 0. + * @param memoryGb the amount of memory that allocation policies should allocate to this container. + * This is a hard upper limit. To allow the container to allocate an unlimited amount use 0. * @return the container resources encapsulating the parameters */ - public static ContainerResources from(double cpus, double cpuCores, double memoryGb) { - return new ContainerResources(cpus, - (int) Math.round(10 * cpuCores), + public static ContainerResources from(double maxVcpu, double minVcpu, double memoryGb) { + return new ContainerResources(maxVcpu, + (int) Math.round(10 * minVcpu), (long) ((1L << 30) * memoryGb)); } diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java index 0158b848f9b..4c21bc47483 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java @@ -367,7 +367,7 @@ public class NodeAgentImpl implements NodeAgent { .value() * node.getMinCpuCores(); if ( contextSupplier.currentContext().zoneId().environment() == Environment.dev) // don't limit cpu - return ContainerResources.from(0, 0, node.getMinMainMemoryAvailableGb()); + return ContainerResources.from(0, node.getMinCpuCores(), node.getMinMainMemoryAvailableGb()); else return ContainerResources.from(cpuCap, node.getMinCpuCores(), node.getMinMainMemoryAvailableGb()); } |