private NodeResources availableCapacityOf(Node host, boolean excludeInactive, boolean requireIps) {
        // Only hosts have free capacity
        if ( ! host.type().canRun(NodeType.tenant)) return NodeResources.zero();
        if (   requireIps && freeIps(host) == 0) return NodeResources.zero();

        NodeResources hostResources = hostResourcesCalculator.advertisedResourcesOf(host.flavor());
        return allNodes.childrenOf(host).stream()
                       .filter(node -> !(excludeInactive && inactiveOrRetired(node)))
                       .map(node -> node.flavor().resources().justNumbers())
                       .reduce(hostResources.justNumbers(), NodeResources::subtract)
                       .with(host.flavor().resources().diskSpeed())
                       .with(host.flavor().resources().storageType())
                       .with(host.flavor().resources().architecture());
    }
Calculate the unused capacity of given host.

Note that unlike {@link #availableCapacityOf(Node)}, this only considers resources and returns any unused
capacity even if the host does not have available IP addresses.

@param host the host to find free capacity of
@return a default (empty) capacity if not host, otherwise the free capacity
node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/HostCapacity.java