From 8140f0441cfdf1c49d78b4c6d43c5f6d4e2aaa6b Mon Sep 17 00:00:00 2001 From: Jon Bratseth Date: Mon, 18 May 2020 16:04:37 +0200 Subject: Consider all group sizes --- .../main/java/com/yahoo/config/provision/NodeResources.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'config-provisioning/src') 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. * -- cgit v1.2.3