Skip to content

Commit

Permalink
Handle correctly QuotaError in EC2 API
Browse files Browse the repository at this point in the history
Without this patch, EC2 API returns UnknownError when quota is exceeded, see bug #853381

This patch fixes that by handling the exception. Now euca-run-instances returns useful information:

$ euca-run-instances --instance-count 10 --instance-type m1.8gb.2cpus.diskless ami-00000012
QuotaError: Quota exceeded: code=InstanceLimitExceeded

Change-Id: I1f7b381b34d2f538b7cc2d9582a40fd8bf88fbc3
Signed-off-by: Julien Danjou <julien@danjou.info>
  • Loading branch information
Julien Danjou committed Mar 22, 2012
1 parent 298aac4 commit 9d32862
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions nova/api/ec2/__init__.py
Expand Up @@ -629,6 +629,10 @@ def __call__(self, req):
LOG.debug(_('InvalidRequest raised: %s'), unicode(ex),
context=context)
return ec2_error(req, request_id, type(ex).__name__, unicode(ex))
except exception.QuotaError as ex:
LOG.debug(_('QuotaError raised: %s'), unicode(ex),
context=context)
return ec2_error(req, request_id, type(ex).__name__, unicode(ex))
except exception.InvalidInstanceIDMalformed as ex:
LOG.debug(_('ValidatorError raised: %s'), unicode(ex),
context=context)
Expand Down

0 comments on commit 9d32862

Please sign in to comment.