public void setTarget(NodeType nodeType, Version version, boolean force) {
        require(nodeType);
        requireNonEmpty(version);
        writeChange((change) -> {
            Optional<OsVersionTarget> currentTarget = Optional.ofNullable(change.targets().get(nodeType));
            Optional<Version> currentVersion = currentTarget.map(OsVersionTarget::version);

            if (currentVersion.equals(Optional.of(version))) {
                return change; // Version unchanged: Nothing to do
            }

            if (!force && currentVersion.filter(v -> v.isAfter(version)).isPresent()) {
                throw new IllegalArgumentException("Cannot set target OS version to " + version.toFullString() +
                                                   " without setting 'force', as it's lower than the current version: "
                                                   + currentTarget.get().version().toFullString());
            }

            LOG.info("Set OS target version for " + nodeType + " nodes to " + version.toFullString());
            return change.withTarget(version, nodeType);
        });
    }
Set the target OS version for nodes of given type
node-repository/src/main/java/com/yahoo/vespa/hosted/provision/os/OsVersions.java