def allowed_volumes(context, requested_volumes, size):
    project_id = context.project_id
    context = context.elevated()
    size = int(size)
    requested_gigabytes = requested_volumes * size
    used_volumes, used_gigabytes = db.volume_data_get_for_project(context,
                                                                  project_id)
    quota = get_project_quotas(context, project_id)
    allowed_volumes = _get_request_allotment(requested_volumes, used_volumes,
                                             quota['volumes'])
    allowed_gigabytes = _get_request_allotment(requested_gigabytes,
                                               used_gigabytes,
                                               quota['gigabytes'])
    if size != 0:
        allowed_volumes = min(allowed_volumes,
                              int(allowed_gigabytes // size))
    return min(requested_volumes, allowed_volumes)
Check quota and return min(requested_volumes, allowed_volumes).
dataset/ETHPy150Open nii-cloud/dodai-compute/nova/quota.py/allowed_volumes