diff options
author | Martin Polden <mpolden@mpolden.no> | 2022-12-01 09:22:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-01 09:22:34 +0100 |
commit | 6826fbab9fc00e4a76d52f8aa6b489f55ef8a3ac (patch) | |
tree | 25857d47f3e5a2a5a0a2b2f271c64dc7aa528712 | |
parent | cca0ab26c35c6837cd3c064ddfcd358319dbb94c (diff) | |
parent | a3c84bb8e7bdeffdf72f732712326865c6dd2815 (diff) |
Merge pull request #25058 from vespa-engine/freva/disallow-node-rebuild
Disallow node rebuild
3 files changed, 3 insertions, 14 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 7e4850c2d16..a4aa4daa790 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 @@ -123,6 +123,7 @@ public final class Node implements Nodelike { if (!ipConfig.pool().ipSet().isEmpty()) throw new IllegalArgumentException("A child node cannot have an IP address pool"); if (modelName.isPresent()) throw new IllegalArgumentException("A child node cannot have model name set"); if (switchHostname.isPresent()) throw new IllegalArgumentException("A child node cannot have switch hostname set"); + if (status.wantToRebuild()) throw new IllegalArgumentException("A child node cannot be rebuilt"); } if (type != NodeType.host && reservedTo.isPresent()) 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 1e2ecb98a42..b98c9c97437 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 @@ -659,7 +659,7 @@ public class Nodes { if (wantToRetire) { // Apply recursively if we're retiring List<Node> updatedNodes = performOn(list().childrenOf(host), (node, nodeLock) -> { - Node newNode = node.withWantToRetire(wantToRetire, wantToDeprovision, wantToRebuild, agent, instant); + Node newNode = node.withWantToRetire(wantToRetire, wantToDeprovision, false, agent, instant); return write(newNode, nodeLock); }); result.addAll(updatedNodes); 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 d7cd42f5c96..7947fe9f021 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 @@ -3,7 +3,6 @@ package com.yahoo.vespa.hosted.provision.provisioning; import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.ApplicationTransaction; -import com.yahoo.config.provision.CloudAccount; import com.yahoo.config.provision.ClusterMembership; import com.yahoo.config.provision.ClusterSpec; import com.yahoo.config.provision.Flavor; @@ -89,8 +88,7 @@ class Activator { NodeList activeToRemove = oldActive.matching(node -> ! hostnames.contains(node.hostname())); remove(activeToRemove, transaction); // TODO: Pass activation time in this call and next line - // TODO (freva): Replace .mapToList(...) with .asList() after 8.80 - nodeRepository.nodes().activate(newActive.mapToList(node -> fixCloudAccount(node, allNodes)), transaction.nested()); // activate also continued active to update node state + nodeRepository.nodes().activate(newActive.asList(), transaction.nested()); // activate also continued active to update node state rememberResourceChange(transaction, generation, activationTime, oldActive.not().retired(), @@ -250,14 +248,4 @@ class Activator { return null; } - private Node fixCloudAccount(Node node, NodeList allNodes) { - // Existing nodes do not have cloudAccount set, copy the one from parent - CloudAccount cloudAccount = allNodes.parentOf(node).map(Node::cloudAccount).orElseGet(node::cloudAccount); - return new Node(node.id(), node.ipConfig(), node.hostname(), - node.parentHostname(), node.flavor(), node.status(), node.state(), node.allocation(), node.history(), - node.type(), node.reports(), node.modelName(), node.reservedTo(), - node.exclusiveToApplicationId(), node.exclusiveToClusterType(), node.switchHostname(), - node.trustedCertificates(), cloudAccount, node.wireguardPubKey()); - } - } |