diff options
Diffstat (limited to 'node-repository/src/main/java/com/yahoo')
6 files changed, 19 insertions, 11 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/Node.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/Node.java index 5135ae73ea1..1f4bd55525d 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/Node.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/Node.java @@ -269,8 +269,10 @@ public final class Node implements Nodelike { } /** Returns a node with the flavor assigned to the given value */ - public Node with(Flavor flavor) { - return new Node(id, ipConfig, hostname, parentHostname, flavor, status, state, allocation, history, type, + public Node with(Flavor flavor, Agent agent, Instant instant) { + if (flavor.equals(this.flavor)) return this; + History updateHistory = history.with(new History.Event(History.Event.Type.resized, agent, instant)); + return new Node(id, ipConfig, hostname, parentHostname, flavor, status, state, allocation, updateHistory, type, reports, modelName, reservedTo, exclusiveTo, switchHostname); } diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/History.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/History.java index 755cd72be93..0c5a8ea1d9f 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/History.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/History.java @@ -158,6 +158,8 @@ public class History { down, // The node made a config request, indicating it is live requested, + // The node resources/flavor were changed + resized(false), // The node was rebooted rebooted(false), // The node upgraded its OS (implies a reboot) diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/NodeSerializer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/NodeSerializer.java index f08d7aa07e1..9d36be67431 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/NodeSerializer.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/NodeSerializer.java @@ -420,6 +420,7 @@ public class NodeSerializer { case "deallocated" : return History.Event.Type.deallocated; case "down" : return History.Event.Type.down; case "requested" : return History.Event.Type.requested; + case "resized" : return History.Event.Type.resized; case "rebooted" : return History.Event.Type.rebooted; case "osUpgraded" : return History.Event.Type.osUpgraded; case "firmwareVerified" : return History.Event.Type.firmwareVerified; @@ -444,6 +445,7 @@ public class NodeSerializer { case deallocated : return "deallocated"; case down : return "down"; case requested: return "requested"; + case resized: return "resized"; case rebooted: return "rebooted"; case osUpgraded: return "osUpgraded"; case firmwareVerified: return "firmwareVerified"; diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Activator.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Activator.java index 49eb44a4ec0..03db7e0e7e5 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Activator.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Activator.java @@ -14,6 +14,7 @@ import com.yahoo.vespa.hosted.provision.NodeMutex; import com.yahoo.vespa.hosted.provision.NodeRepository; import com.yahoo.vespa.hosted.provision.applications.Application; import com.yahoo.vespa.hosted.provision.applications.ScalingEvent; +import com.yahoo.vespa.hosted.provision.node.Agent; import com.yahoo.vespa.hosted.provision.node.Allocation; import java.time.Instant; @@ -216,7 +217,7 @@ class Activator { HostSpec hostSpec = getHost(node.hostname(), hosts); node = hostSpec.membership().get().retired() ? node.retire(at) : node.unretire(); if (! hostSpec.advertisedResources().equals(node.resources())) // A resized node - node = node.with(new Flavor(hostSpec.advertisedResources())); + node = node.with(new Flavor(hostSpec.advertisedResources()), Agent.application, at); Allocation allocation = node.allocation().get() .with(hostSpec.membership().get()) .withRequestedResources(hostSpec.requestedResources() diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeAllocation.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeAllocation.java index e014b50a25f..3d3a54774e4 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeAllocation.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeAllocation.java @@ -272,7 +272,8 @@ class NodeAllocation { NodeResources hostResources = allNodes.parentOf(node).get().flavor().resources(); return node.with(new Flavor(requestedNodes.resources().get() .with(hostResources.diskSpeed()) - .with(hostResources.storageType()))); + .with(hostResources.storageType())), + Agent.application, nodeRepository.clock().instant()); } private Node setCluster(ClusterSpec cluster, Node node) { diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/NodePatcher.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/NodePatcher.java index ea951798da0..e8fa4f04eed 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/NodePatcher.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/NodePatcher.java @@ -132,7 +132,7 @@ public class NodePatcher implements AutoCloseable { case "failCount" : return node.with(node.status().withFailCount(asLong(value).intValue())); case "flavor" : - return node.with(nodeFlavors.getFlavorOrThrow(asString(value))); + return node.with(nodeFlavors.getFlavorOrThrow(asString(value)), Agent.operator, clock.instant()); case "parentHostname" : return node.withParentHostname(asString(value)); case "ipAddresses" : @@ -152,19 +152,19 @@ public class NodePatcher implements AutoCloseable { return node.withOpenStackId(asString(value)); case "diskGb": case "minDiskAvailableGb": - return node.with(node.flavor().with(node.flavor().resources().withDiskGb(value.asDouble()))); + return node.with(node.flavor().with(node.flavor().resources().withDiskGb(value.asDouble())), Agent.operator, clock.instant()); case "memoryGb": case "minMainMemoryAvailableGb": - return node.with(node.flavor().with(node.flavor().resources().withMemoryGb(value.asDouble()))); + return node.with(node.flavor().with(node.flavor().resources().withMemoryGb(value.asDouble())), Agent.operator, clock.instant()); case "vcpu": case "minCpuCores": - return node.with(node.flavor().with(node.flavor().resources().withVcpu(value.asDouble()))); + return node.with(node.flavor().with(node.flavor().resources().withVcpu(value.asDouble())), Agent.operator, clock.instant()); case "fastDisk": - return node.with(node.flavor().with(node.flavor().resources().with(value.asBool() ? fast : slow))); + return node.with(node.flavor().with(node.flavor().resources().with(value.asBool() ? fast : slow)), Agent.operator, clock.instant()); case "remoteStorage": - return node.with(node.flavor().with(node.flavor().resources().with(value.asBool() ? remote : local))); + return node.with(node.flavor().with(node.flavor().resources().with(value.asBool() ? remote : local)), Agent.operator, clock.instant()); case "bandwidthGbps": - return node.with(node.flavor().with(node.flavor().resources().withBandwidthGbps(value.asDouble()))); + return node.with(node.flavor().with(node.flavor().resources().withBandwidthGbps(value.asDouble())), Agent.operator, clock.instant()); case "modelName": return value.type() == Type.NIX ? node.withoutModelName() : node.withModelName(asString(value)); case "requiredDiskSpeed": |