summaryrefslogtreecommitdiffstats
path: root/node-repository
diff options
context:
space:
mode:
authorValerij Fredriksen <valerijf@yahooinc.com>2023-05-05 10:43:39 +0200
committerValerij Fredriksen <valerijf@yahooinc.com>2023-05-05 10:43:39 +0200
commit8ba9eafa16de162d16082f56e9fb9764cffe2aeb (patch)
tree57057f47435677c42029a045c725b406d8b4e1df /node-repository
parent1d0076c194c06b2306599ac5b68db702a17d9f73 (diff)
Set cloudAccount for all nodes without one to system account
Diffstat (limited to 'node-repository')
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/Node.java7
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Nodes.java7
2 files changed, 13 insertions, 1 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 3b518728607..a77b198cfe4 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
@@ -341,6 +341,13 @@ public final class Node implements Nodelike {
trustStoreItems, cloudAccount, wireguardPubKey);
}
+ /** Returns a node with the cloud account assigned to the given value */
+ public Node with(CloudAccount cloudAccount) {
+ return new Node(id, ipConfig, hostname, parentHostname, flavor, status, state, allocation, history, type,
+ reports, modelName, reservedTo, exclusiveToApplicationId, exclusiveToClusterType, switchHostname,
+ trustStoreItems, cloudAccount, wireguardPubKey);
+ }
+
/** Returns a node with the flavor assigned to the given value */
public Node with(Flavor flavor, Agent agent, Instant instant) {
if (flavor.equals(this.flavor)) return this;
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Nodes.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Nodes.java
index fd6b15609d6..478d49d67d4 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Nodes.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Nodes.java
@@ -79,7 +79,12 @@ public class Nodes {
/** Read and write all nodes to make sure they are stored in the latest version of the serialized format */
public void rewrite() {
Instant start = clock.instant();
- int nodesWritten = performOn(list(), this::write).size();
+ int nodesWritten = performOn(list(), (node, mutex) -> {
+ // TODO (valerijf): Remove after 8.162
+ if (node.cloudAccount().isUnspecified() && !zone.getCloud().account().isUnspecified())
+ node = node.with(zone.getCloud().account());
+ return write(node, mutex);
+ }).size();
Instant end = clock.instant();
log.log(Level.INFO, String.format("Rewrote %d nodes in %s", nodesWritten, Duration.between(start, end)));
}