summaryrefslogtreecommitdiffstats
path: root/config-provisioning
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@verizonmedia.com>2019-08-14 15:00:42 +0200
committerJon Bratseth <bratseth@verizonmedia.com>2019-08-14 15:00:42 +0200
commitae999dae9a063687ae88d2c42d95356a88a721c0 (patch)
treef22f8b4866f754fa439432870d119beea05431a3 /config-provisioning
parentc14335ef8f814e71ed7f1edf35b0e2167fec4e65 (diff)
Remove legacyName
Diffstat (limited to 'config-provisioning')
-rw-r--r--config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java27
1 files changed, 8 insertions, 19 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 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<String> 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);
}
}