'Enforce quota limits on injected files.
Raises a QuotaError if any limit is exceeded.'

def _check_injected_file_quota(self, context, injected_files):

    if (injected_files is None):
        return
    try:
        objects.Quotas.limit_check(context, injected_files=len(injected_files))
    except exception.OverQuota:
        raise exception.OnsetFileLimitExceeded()
    max_path = 0
    max_content = 0
    for (path, content) in injected_files:
        max_path = max(max_path, len(path))
        max_content = max(max_content, len(content))
    try:
        objects.Quotas.limit_check(context, injected_file_path_bytes=max_path, injected_file_content_bytes=max_content)
    except exception.OverQuota as exc:
        if ('injected_file_path_bytes' in exc.kwargs['overs']):
            raise exception.OnsetFilePathLimitExceeded()
        else:
            raise exception.OnsetFileContentLimitExceeded()
