Optional<HostDeficit> hostDeficit() {
        if (nodeType().isHost()) {
            return Optional.empty(); // Hosts are provisioned as required by the child application
        }
        int deficit = requested.fulfilledDeficitCount(acceptedAndCompatibleOrResizable());
        // We can only require flavor upgrade if the entire deficit is caused by upgrades
        boolean dueToFlavorUpgrade = deficit == wasRetiredDueToFlavorUpgrade;
        return Optional.of(new HostDeficit(requested.resources().orElseGet(NodeResources::unspecified),
                                           deficit,
                                           dueToFlavorUpgrade))
                       .filter(hostDeficit -> hostDeficit.count() > 0);
    }
Returns {@link HostDeficit} describing the host deficit for the given {@link NodeSpec}.

@return empty if the requested spec is already fulfilled. Otherwise, returns {@link HostDeficit} containing the
        flavor and host count required to cover the deficit.
node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeAllocation.java