Allow patching node resources
@@ -30,6 +30,9 @@ import java.util.Set;
import java.util.TreeSet;
import java.util.stream.Collectors;
+import static com.yahoo.config.provision.NodeResources.DiskSpeed.fast;
+import static com.yahoo.config.provision.NodeResources.DiskSpeed.slow;
+
/**
* A class which can take a partial JSON node/v2 node JSON structure and apply it to a node object.
* This is a one-time use object.
@@ -144,6 +147,16 @@ public class NodePatcher {
return nodeWithPatchedReports(node, value);
case "openStackId" :
return node.withOpenStackId(asString(value));
+ case "minDiskAvailableGb":
+ return node.with(node.flavor().with(node.flavor().resources().withDiskGb(value.asDouble())));
+ case "minMainMemoryAvailableGb":
+ return node.with(node.flavor().with(node.flavor().resources().withMemoryGb(value.asDouble())));
+ case "minCpuCores":
+ return node.with(node.flavor().with(node.flavor().resources().withVcpu(value.asDouble())));
+ case "fastDisk":
+ return node.with(node.flavor().with(node.flavor().resources().withDiskSpeed(value.asBool() ? fast : slow)));
+ case "bandwidth":
+ return node.with(node.flavor().with(node.flavor().resources().withBandwidthGbps(value.asDouble() / 1000)));
case "modelName":
if (value.type() == Type.NIX) {
return node.withoutModelName();
