diff options
author | Valerij Fredriksen <valerijf@verizonmedia.com> | 2019-08-13 11:53:21 +0200 |
---|---|---|
committer | Valerij Fredriksen <valerijf@verizonmedia.com> | 2019-08-13 11:53:21 +0200 |
commit | 8d3b494c03f11e63d5e7459f7bd855b94ef37fdd (patch) | |
tree | c182937e34e406502715e84b35be983454e70aa9 /config-provisioning | |
parent | e8d378186fbe5c51666ca104011e1f2024dd9532 (diff) |
Ress resources is not compatible with more resources
Diffstat (limited to 'config-provisioning')
-rw-r--r-- | config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java | 15 |
1 files changed, 14 insertions, 1 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 165b497252d..7e90767c9c5 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 @@ -149,7 +149,7 @@ public class NodeResources { if (this.allocateByLegacyName || other.allocateByLegacyName) // resources are not available return Objects.equals(this.legacyName, other.legacyName); - if (this.vcpu < other.vcpu()) return false; + if (this.vcpu < other.vcpu) return false; if (this.memoryGb < other.memoryGb) return false; if (this.diskGb < other.diskGb) return false; @@ -161,6 +161,19 @@ public class NodeResources { return true; } + /** 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.allocateByLegacyName || other.allocateByLegacyName) // resources are not available + return Objects.equals(this.legacyName, other.legacyName); + + if (this.vcpu != other.vcpu) return false; + if (this.memoryGb != other.memoryGb) return false; + if (this.diskGb != other.diskGb) return false; + if (other.diskSpeed != DiskSpeed.any && other.diskSpeed != this.diskSpeed) return false; + + return true; + } + /** * Create this from serial form. * |