diff options
author | andreer <andreer@verizonmedia.com> | 2019-11-08 11:11:35 +0100 |
---|---|---|
committer | andreer <andreer@verizonmedia.com> | 2019-11-08 11:11:35 +0100 |
commit | 59f5fb64420ed7c319933e11ec5ef01baf611227 (patch) | |
tree | 6fa643f286782cbd255216d954a1482bd66b022c /node-repository | |
parent | 7b07a0e1ae676c764d404aa13e62cc8bb2877257 (diff) |
make required disk speed patchable
Diffstat (limited to 'node-repository')
-rw-r--r-- | node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/NodePatcher.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/NodePatcher.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/NodePatcher.java index 5f4c300b496..072dc1172e1 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/NodePatcher.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/NodePatcher.java @@ -5,6 +5,7 @@ import com.yahoo.component.Version; import com.yahoo.config.provision.DockerImage; import com.yahoo.config.provision.Flavor; import com.yahoo.config.provision.NodeFlavors; +import com.yahoo.config.provision.NodeResources; import com.yahoo.io.IOUtils; import com.yahoo.slime.Inspector; import com.yahoo.slime.ObjectTraverser; @@ -159,6 +160,8 @@ public class NodePatcher { return node.withoutModelName(); } return node.withModelName(asString(value)); + case "requiredDiskSpeed": + return patchRequiredDiskSpeed(asString(value)); default : throw new IllegalArgumentException("Could not apply field '" + name + "' on a node: No such modifiable field"); } @@ -197,6 +200,15 @@ public class NodePatcher { return strings; } + + private Node patchRequiredDiskSpeed(String value) { + Optional<Allocation> allocation = node.allocation(); + if (allocation.isPresent()) + return node.with(allocation.get().withRequestedResources( + allocation.get().requestedResources().withDiskSpeed(NodeResources.DiskSpeed.valueOf(value)))); + else + throw new IllegalArgumentException("Node is not allocated"); + } private Node patchCurrentRestartGeneration(Long value) { Optional<Allocation> allocation = node.allocation(); |