Ejemplo n.º 1
0
def _get_tenant_network_usages(request, usages, disabled_quotas, tenant_id):
    enabled_quotas = NEUTRON_QUOTA_FIELDS - disabled_quotas
    if not enabled_quotas:
        return

    details = neutron.tenant_quota_detail_get(request, tenant_id)
    for quota_name in NEUTRON_QUOTA_FIELDS:
        if quota_name in disabled_quotas:
            continue
        detail = details[quota_name]
        usages.add_quota(base.Quota(quota_name, detail['limit']))
        usages.tally(quota_name, detail['used'] + detail['reserved'])
Ejemplo n.º 2
0
def _get_tenant_network_usages(request, usages, disabled_quotas, tenant_id):
    enabled_quotas = NEUTRON_QUOTA_FIELDS - disabled_quotas
    if not enabled_quotas:
        return

    if neutron.is_extension_supported(request, 'quota_details'):
        details = neutron.tenant_quota_detail_get(request, tenant_id)
        for quota_name in NEUTRON_QUOTA_FIELDS:
            if quota_name in disabled_quotas:
                continue
            detail = details[quota_name]
            usages.add_quota(base.Quota(quota_name, detail['limit']))
            usages.tally(quota_name, detail['used'] + detail['reserved'])
    else:
        _get_tenant_network_usages_legacy(
            request, usages, disabled_quotas, tenant_id)