public Node withWantToRetire(boolean wantToRetire, boolean wantToDeprovision, boolean wantToRebuild, boolean bootingAfterRebuild, boolean wantToUpgradeFlavor, Agent agent, Instant at) {
        if (wantToRetire == status.wantToRetire() &&
            wantToDeprovision == status.wantToDeprovision() &&
            wantToRebuild == status.wantToRebuild() &&
            bootingAfterRebuild == status.bootingAfterRebuild() &&
            wantToUpgradeFlavor == status.wantToUpgradeFlavor()) return this;
        Node node = this.with(status.withWantToRetire(wantToRetire, wantToDeprovision, wantToRebuild, bootingAfterRebuild, wantToUpgradeFlavor));
        if (wantToRetire)
            node = node.with(history.with(new History.Event(History.Event.Type.wantToRetire, agent, at)));
        return node;
    }
Returns a copy of this node with wantToRetire, wantToDeprovision and wantToRebuild set to the given values
and updated history.

If all given values are equal to the current ones, the method is no-op.
node-repository/src/main/java/com/yahoo/vespa/hosted/provision/Node.java