'Returns the number of compute resource providers in the API database
The resource provider count is filtered based on resource providers
which have inventories records for the VCPU resource class, which is
assumed to only come from the ResourceTracker in compute nodes.'

@staticmethod
def _count_compute_resource_providers():

    vcpu_rc_id = fields.ResourceClass.STANDARD.index(fields.ResourceClass.VCPU)
    meta = MetaData(bind=db_session.get_api_engine())
    inventories = Table('inventories', meta, autoload=True)
    return select([sqlfunc.count()]).select_from(inventories).where((inventories.c.resource_class_id == vcpu_rc_id)).scalar()
