summaryrefslogtreecommitdiffstats
path: root/config-provisioning/src
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2020-05-18 16:04:37 +0200
committerJon Bratseth <bratseth@gmail.com>2020-05-18 16:04:37 +0200
commit8140f0441cfdf1c49d78b4c6d43c5f6d4e2aaa6b (patch)
treee9800af577213e9da9ec37cbc6f11f9f968607e9 /config-provisioning/src
parent60b1619d6c154c352fe47153d02279dc6698eb18 (diff)
Consider all group sizes
Diffstat (limited to 'config-provisioning/src')
-rw-r--r--config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java12
1 files changed, 8 insertions, 4 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 04b004bb5a5..91604cd667d 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
@@ -242,10 +242,10 @@ public class NodeResources {
/** Returns true if all the resources of this are the same as or compatible with the given resources */
public boolean compatibleWith(NodeResources other) {
- if (this.vcpu != other.vcpu) return false;
- if (this.memoryGb != other.memoryGb) return false;
- if (this.diskGb != other.diskGb) return false;
- if (this.bandwidthGbps != other.bandwidthGbps) return false;
+ if ( ! equal(this.vcpu, other.vcpu)) return false;
+ if ( ! equal(this.memoryGb, other.memoryGb)) return false;
+ if ( ! equal(this.diskGb, other.diskGb)) return false;
+ if ( ! equal(this.bandwidthGbps, other.bandwidthGbps)) return false;
if ( ! this.diskSpeed.compatibleWith(other.diskSpeed)) return false;
if ( ! this.storageType.compatibleWith(other.storageType)) return false;
@@ -254,6 +254,10 @@ public class NodeResources {
public boolean isUnspecified() { return this == unspecified; }
+ private boolean equal(double a, double b) {
+ return Math.abs(a - b) < 0.00000001;
+ }
+
/**
* Create this from serial form.
*