diff options
Diffstat (limited to 'node-repository/src/main/java/com/yahoo')
3 files changed, 6 insertions, 6 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/NodeRepository.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/NodeRepository.java index 9bb8c1f28a1..3f752eafa0e 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/NodeRepository.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/NodeRepository.java @@ -305,7 +305,7 @@ public class NodeRepository extends AbstractComponent { } /** Sets a list of nodes ready and returns the nodes in the ready state */ - public List<Node> setReady(List<Node> nodes) { + public List<Node> setReady(List<Node> nodes, Agent agent, String reason) { try (Mutex lock = lockUnallocated()) { List<Node> nodesWithResetFields = nodes.stream() .map(node -> { @@ -315,16 +315,16 @@ public class NodeRepository extends AbstractComponent { }) .collect(Collectors.toList()); - return db.writeTo(Node.State.ready, nodesWithResetFields, Agent.system, Optional.empty()); + return db.writeTo(Node.State.ready, nodesWithResetFields, agent, Optional.of(reason)); } } - public Node setReady(String hostname) { + public Node setReady(String hostname, Agent agent, String reason) { Node nodeToReady = getNode(hostname).orElseThrow(() -> new NoSuchNodeException("Could not move " + hostname + " to ready: Node not found")); if (nodeToReady.state() == Node.State.ready) return nodeToReady; - return setReady(Collections.singletonList(nodeToReady)).get(0); + return setReady(Collections.singletonList(nodeToReady), agent, reason).get(0); } /** Reserve nodes. This method does <b>not</b> lock the node repository */ diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/NodesApiHandler.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/NodesApiHandler.java index cd646f293f7..34111797de6 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/NodesApiHandler.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/NodesApiHandler.java @@ -108,7 +108,7 @@ public class NodesApiHandler extends LoggingRequestHandler { String path = request.getUri().getPath(); // Check paths to disallow illegal state changes if (path.startsWith("/nodes/v2/state/ready/")) { - nodeRepository.setReady(lastElement(path)); + nodeRepository.setReady(lastElement(path), Agent.operator, "Readied through the nodes/v2 API"); return new MessageResponse("Moved " + lastElement(path) + " to ready"); } else if (path.startsWith("/nodes/v2/state/failed/")) { diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/testutils/MockNodeRepository.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/testutils/MockNodeRepository.java index 7af28efd293..b7392f3aee6 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/testutils/MockNodeRepository.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/testutils/MockNodeRepository.java @@ -104,7 +104,7 @@ public class MockNodeRepository extends NodeRepository { nodes.remove(6); nodes.remove(7); nodes = setDirty(nodes, Agent.system, getClass().getSimpleName()); - setReady(nodes); + setReady(nodes, Agent.system, getClass().getSimpleName()); fail("host5.yahoo.com", Agent.system, getClass().getSimpleName()); setDirty("host55.yahoo.com", Agent.system, getClass().getSimpleName()); |