'Checks the status of resource provider reporting.
This check relies on the cells v2 check passing because it queries the
cells for compute nodes using cell mappings.
This check relies on the placement service running because if it\'s not
then there won\'t be any resource providers for the filter scheduler to
use during instance build and move requests.
Note that in Ocata, the filter scheduler will only use placement if
the minimum nova-compute service version in the deployment is >= 16
which signals when nova-compute will fail to start if placement is not
configured on the compute. Otherwise the scheduler will fallback
to pulling compute nodes from the database directly as it has always
done. That fallback will be removed in Pike.'

def _check_resource_providers(self):

    num_rps = self._count_compute_resource_providers()
    cell_mappings = self._get_non_cell0_mappings()
    ctxt = nova_context.get_admin_context()
    num_computes = 0
    for cell_mapping in cell_mappings:
        with nova_context.target_cell(ctxt, cell_mapping) as cctxt:
            num_computes += self._count_compute_nodes(cctxt)
    else:
        num_computes = self._count_compute_nodes()
    if (num_rps == 0):
        if (num_computes != 0):
            msg = (_('There    are    no    compute    resource    providers    in    the    Placement    service    but    there    are    %(num_computes)s    compute    nodes    in    the    deployment.    This    means    no    compute    nodes    are    reporting    into    the    Placement    service    and    need    to    be    upgraded    and/or    fixed.    See    %(placement_docs_link)s    for    more    details.') % {'num_computes': num_computes, 'placement_docs_link': PLACEMENT_DOCS_LINK})
            return UpgradeCheckResult(UpgradeCheckCode.WARNING, msg)
        msg = (_('There    are    no    compute    resource    providers    in    the    Placement    service    nor    are    there    compute    nodes    in    the    database.    Remember    to    configure    new    compute    nodes    to    report    into    the    Placement    service.    See    %(placement_docs_link)s    for    more    details.') % {'placement_docs_link': PLACEMENT_DOCS_LINK})
        return UpgradeCheckResult(UpgradeCheckCode.SUCCESS, msg)
    elif (num_rps < num_computes):
        msg = (_('There    are    %(num_resource_providers)s    compute    resource    providers    and    %(num_compute_nodes)s    compute    nodes    in    the    deployment.    Ideally    the    number    of    compute    resource    providers    should    equal    the    number    of    enabled    compute    nodes    otherwise    the    cloud    may    be    underutilized.    See    %(placement_docs_link)s    for    more    details.') % {'num_resource_providers': num_rps, 'num_compute_nodes': num_computes, 'placement_docs_link': PLACEMENT_DOCS_LINK})
        return UpgradeCheckResult(UpgradeCheckCode.WARNING, msg)
    else:
        return UpgradeCheckResult(UpgradeCheckCode.SUCCESS)
