Skip to content

Commit

Permalink
refactor onset_files quota checking
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Washenberger committed Mar 15, 2011
1 parent 47b751e commit 1d69d49
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nova/compute/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ def _check_onset_file_quota(self, context, onset_files):
Raises a QuotaError if any limit is exceeded
"""
if onset_files is None:
return
limit = quota.allowed_onset_files(context)
if len(onset_files) > limit:
raise quota.QuotaError(code="OnsetFileLimitExceeded")
Expand All @@ -96,7 +98,6 @@ def _check_onset_file_quota(self, context, onset_files):
raise quota.QuotaError(code="OnsetFilePathLimitExceeded")
if len(content) > content_limit:
raise quota.QuotaError(code="OnsetFileContentLimitExceeded")
return onset_files

def create(self, context, instance_type,
image_id, kernel_id=None, ramdisk_id=None,
Expand Down Expand Up @@ -142,8 +143,7 @@ def create(self, context, instance_type,
LOG.warn(msg)
raise quota.QuotaError(msg, "MetadataLimitExceeded")

if onset_files is not None:
onset_files = self._check_onset_file_quota(context, onset_files)
self._check_onset_file_quota(context, onset_files)

image = self.image_service.show(context, image_id)

Expand Down

0 comments on commit 1d69d49

Please sign in to comment.