private static boolean setWantedStateAccordingToResult(
            Result result,
            NodeState newWantedState,
            SetUnitStateRequest.Condition condition,
            NodeInfo nodeInfo,
            ContentCluster cluster,
            NodeListener stateListener,
            boolean probe) {
        if (result.allowed()) {
            setNewWantedState(nodeInfo, newWantedState, stateListener, probe);
        }

        // True if the wanted state was or has just been set to newWantedState
        boolean success = result.allowed() || result.isAlreadySet();

        if (success && condition == SetUnitStateRequest.Condition.SAFE && nodeInfo.isStorage()) {
            // In safe-mode, setting the storage node must be accompanied by changing the state
            // of the distributor. E.g. setting the storage node to maintenance may cause
            // feeding issues unless distributor is also set down.

            setDistributorWantedState(cluster, nodeInfo.getNodeIndex(), newWantedState, stateListener, probe);
        }

        return success;
    }
Returns true if the current/old wanted state already matches the requested
wanted state, or the requested state has been accepted as the new wanted state.
clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/restapiv2/requests/SetNodeStateRequest.java