From ae999dae9a063687ae88d2c42d95356a88a721c0 Mon Sep 17 00:00:00 2001 From: Jon Bratseth Date: Wed, 14 Aug 2019 15:00:42 +0200 Subject: Remove legacyName --- .../com/yahoo/config/provision/NodeResources.java | 27 +++++++--------------- 1 file changed, 8 insertions(+), 19 deletions(-) (limited to 'config-provisioning') 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 da7050a3187..911bf1f503c 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 @@ -22,9 +22,6 @@ public class NodeResources { private final double diskGb; private final DiskSpeed diskSpeed; - /** The legacy (flavor) name of this, or null if none */ - private final String legacyName; - /** Create node resources requiring fast disk */ public NodeResources(double vcpu, double memoryGb, double diskGb) { this(vcpu, memoryGb, diskGb, DiskSpeed.fast); @@ -35,15 +32,6 @@ public class NodeResources { this.memoryGb = memoryGb; this.diskGb = diskGb; this.diskSpeed = diskSpeed; - this.legacyName = null; - } - - private NodeResources(double vcpu, double memoryGb, double diskGb, DiskSpeed diskSpeed, String legacyName) { - this.vcpu = vcpu; - this.memoryGb = memoryGb; - this.diskGb = diskGb; - this.diskSpeed = diskSpeed; - this.legacyName = legacyName; } public double vcpu() { return vcpu; } @@ -78,8 +66,9 @@ public class NodeResources { } /** Returns the legacy name of this, or empty if none. */ + // TODO: Remove after August 2019 public Optional legacyName() { - return Optional.ofNullable(legacyName); + return Optional.of(toString()); } private boolean isInterchangeableWith(NodeResources other) { @@ -147,12 +136,12 @@ public class NodeResources { * * @throws IllegalArgumentException if the given string cannot be parsed as a serial form of this */ - public static NodeResources fromLegacyName(String string) { - if ( ! string.startsWith("d-")) - throw new IllegalArgumentException("A node specification string must start by 'd-' but was '" + string + "'"); - String[] parts = string.split("-"); + public static NodeResources fromLegacyName(String name) { + if ( ! name.startsWith("d-")) + throw new IllegalArgumentException("A node specification string must start by 'd-' but was '" + name + "'"); + String[] parts = name.split("-"); if (parts.length != 4) - throw new IllegalArgumentException("A node specification string must contain three numbers separated by '-' but was '" + string + "'"); + throw new IllegalArgumentException("A node specification string must contain three numbers separated by '-' but was '" + name + "'"); double cpu = Integer.parseInt(parts[1]); double mem = Integer.parseInt(parts[2]); @@ -160,7 +149,7 @@ public class NodeResources { if (cpu == 0) cpu = 0.5; if (cpu == 2 && mem == 8 ) cpu = 1.5; if (cpu == 2 && mem == 12 ) cpu = 2.3; - return new NodeResources(cpu, mem, dsk, DiskSpeed.fast, string); + return new NodeResources(cpu, mem, dsk, DiskSpeed.fast); } } -- cgit v1.2.3