aboutsummaryrefslogtreecommitdiffstats
path: root/config-provisioning
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2022-11-21 09:15:34 +0100
committerMartin Polden <mpolden@mpolden.no>2022-11-21 09:19:10 +0100
commit582706592fd21dd91666911f8175527a0e36d5b6 (patch)
tree782163928fea97e1652c6fecb0ffeffdae3e8837 /config-provisioning
parent32fdbad465c00e018168a0965f2b5870f2ee1b39 (diff)
Ensure GPU resources are included in copy methods
Diffstat (limited to 'config-provisioning')
-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 e03ebb4d8da..d4827f07a80 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) {