From de07a398d52413413ff1688411707cd67de69164 Mon Sep 17 00:00:00 2001 From: Jon Bratseth Date: Wed, 8 Nov 2017 15:38:38 +0100 Subject: In-place flavor downsize --- .../src/main/java/com/yahoo/config/provision/Flavor.java | 11 +++++++++++ .../src/main/resources/configdefinitions/flavors.def | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'config-provisioning/src') diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/Flavor.java b/config-provisioning/src/main/java/com/yahoo/config/provision/Flavor.java index fc3e46a46d6..b0c04cea1b0 100644 --- a/config-provisioning/src/main/java/com/yahoo/config/provision/Flavor.java +++ b/config-provisioning/src/main/java/com/yahoo/config/provision/Flavor.java @@ -76,6 +76,9 @@ public class Flavor { } public Type getType() { return type; } + + /** Convenience, returns getType() == Type.DOCKER_CONTAINER */ + public boolean isDocker() { return type == Type.DOCKER_CONTAINER; } /** The free capacity we would like to preserve for this flavor */ public int getIdealHeadroom() { @@ -131,6 +134,14 @@ public class Flavor { public void freeze() { replacesFlavors = ImmutableList.copyOf(replacesFlavors); } + + /** Returns whether this flavor has at least as much as each hardware resource as the given flavor */ + public boolean isLargerThan(Flavor other) { + return this.minCpuCores >= other.minCpuCores && + this.minDiskAvailableGb >= other.minDiskAvailableGb && + this.minMainMemoryAvailableGb >= other.minMainMemoryAvailableGb && + this.fastDisk || ! other.fastDisk; + } @Override public int hashCode() { return name.hashCode(); } diff --git a/config-provisioning/src/main/resources/configdefinitions/flavors.def b/config-provisioning/src/main/resources/configdefinitions/flavors.def index a2dcfd3fd07..57affc2f104 100644 --- a/config-provisioning/src/main/resources/configdefinitions/flavors.def +++ b/config-provisioning/src/main/resources/configdefinitions/flavors.def @@ -25,7 +25,7 @@ flavor[].cost int default=0 # for some historical reason. These nodes are assigned to applications by exact match and ignoring cost. flavor[].stock bool default=true -# The type of node (e.g. bare metal, docker..). +# The type of node: BARE_METAL, VIRTUAL_MACHINE or DOCKER_CONTAINER flavor[].environment string default="undefined" # The minimum number of CPU cores available. -- cgit v1.2.3