summaryrefslogtreecommitdiffstats
path: root/config-provisioning
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2020-05-18 18:53:53 +0200
committerGitHub <noreply@github.com>2020-05-18 18:53:53 +0200
commitc73c579251721a5f46ad376b99dd9c94cd1bed94 (patch)
treed29cf5da51916df74744998ae008762f9c32455a /config-provisioning
parent37e567a295a6f1dec583a407225d70bfb690dc70 (diff)
parentb9905b7315e434216cb2115b98f7cdae82194cdf (diff)
Merge pull request #13287 from vespa-engine/bratseth/autoscale-groupsize
Bratseth/autoscale groupsize
Diffstat (limited to 'config-provisioning')
-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.
*