summaryrefslogtreecommitdiffstats
path: root/config-provisioning/src
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-11-21 09:42:07 +0100
committerGitHub <noreply@github.com>2022-11-21 09:42:07 +0100
commit75463c873ed404ffa39c5b8ac21810819a4b3a62 (patch)
treee67aadace18474458955a8c350e94954d669a1bc /config-provisioning/src
parent8f32428bb05196e8b6c9c3855864a9ec51dd250d (diff)
parentd43bbf2ab1016b95a396d38ee855bee09279db9a (diff)
Merge pull request #24940 from vespa-engine/mpolden/fix-ctor
Ensure GPU resources are included in copy methods
Diffstat (limited to 'config-provisioning/src')
-rw-r--r--config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java26
1 files changed, 17 insertions, 9 deletions
diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java b/config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java
index d9a723d69f1..7b1eb945247 100644
--- a/config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java
+++ b/config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java
@@ -214,43 +214,49 @@ public class NodeResources {
public NodeResources withVcpu(double vcpu) {
ensureSpecified();
if (vcpu == this.vcpu) return this;
- return new NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture);
+ return new NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture, gpuResources);
}
public NodeResources withMemoryGb(double memoryGb) {
ensureSpecified();
if (memoryGb == this.memoryGb) return this;
- return new NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture);
+ return new NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture, gpuResources);
}
public NodeResources withDiskGb(double diskGb) {
ensureSpecified();
if (diskGb == this.diskGb) return this;
- return new NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture);
+ return new NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture, gpuResources);
}
public NodeResources withBandwidthGbps(double bandwidthGbps) {
ensureSpecified();
if (bandwidthGbps == this.bandwidthGbps) return this;
- return new NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture);
+ return new NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture, gpuResources);
}
public NodeResources with(DiskSpeed diskSpeed) {
ensureSpecified();
if (diskSpeed == this.diskSpeed) return this;
- return new NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture);
+ return new NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture, gpuResources);
}
public NodeResources with(StorageType storageType) {
ensureSpecified();
if (storageType == this.storageType) return this;
- return new NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture);
+ return new NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture, gpuResources);
}
public NodeResources with(Architecture architecture) {
ensureSpecified();
if (architecture == this.architecture) return this;
- return new NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture);
+ return new NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture, gpuResources);
+ }
+
+ public NodeResources with(GpuResources gpuResources) {
+ ensureSpecified();
+ if (this.gpuResources.equals(gpuResources)) return this;
+ return new NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture, gpuResources);
}
/** Returns this with disk speed and storage type set to any */
@@ -276,7 +282,8 @@ public class NodeResources {
bandwidthGbps - other.bandwidthGbps,
this.diskSpeed.combineWith(other.diskSpeed),
this.storageType.combineWith(other.storageType),
- this.architecture.combineWith(other.architecture));
+ this.architecture.combineWith(other.architecture),
+ gpuResources);
}
public NodeResources add(NodeResources other) {
@@ -289,7 +296,8 @@ public class NodeResources {
bandwidthGbps + other.bandwidthGbps,
this.diskSpeed.combineWith(other.diskSpeed),
this.storageType.combineWith(other.storageType),
- this.architecture.combineWith(other.architecture));
+ this.architecture.combineWith(other.architecture),
+ gpuResources);
}
private boolean isInterchangeableWith(NodeResources other) {