public List<Node> failOrMarkRecursively(String hostname, Agent agent, String reason) {
        List<Node> changed = new ArrayList<>();
        try (RecursiveNodeMutexes nodes = lockAndGetRecursively(hostname, Optional.empty())) {
            for (NodeMutex child : nodes.children())
                changed.add(failOrMark(child.node(), agent, reason, child));

            if (changed.stream().noneMatch(child -> child.state() == Node.State.active))
                changed.add(move(hostname, Node.State.failed, agent, false, Optional.of(reason), nodes.parent()));
            else
                changed.add(failOrMark(nodes.parent().node(), agent, reason, nodes.parent()));
        }
        return changed;
    }
Fails all the nodes that are children of hostname before finally failing the hostname itself.
Non-active nodes are failed immediately, while active nodes are marked as wantToFail.
The host is failed if it has no active nodes and marked wantToFail if it has.

@return all the nodes that were changed by this request
node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Nodes.java