Introduce IncorrectState EC2 error code
'IncorrectState' ec2_code attribute was added to ImageNotActive and VolumeUnattached exceptions. ImageNotActive is now used instead of useless EC2APIError. Although IncorrectState EC2 error code is used for volumes only in Amazon EC2, it's used for incorrect image state in nova as well because there is no error code for this (EC2 images are stateless) and inventing new error code is a bad idea. Implements: blueprint ec2-error-codes Change-Id: I3566bbc4b2eb13482c93933932dd619f90cbc234
This commit is contained in:
@@ -192,6 +192,9 @@ class PolicyNotAuthorized(NotAuthorized):
|
||||
|
||||
|
||||
class ImageNotActive(NovaException):
|
||||
# NOTE(jruzicka): IncorrectState is used for volumes only in EC2,
|
||||
# but it still seems like the most appropriate option.
|
||||
ec2_code = 'IncorrectState'
|
||||
msg_fmt = _("Image %(image_id)s is not active.")
|
||||
|
||||
|
||||
@@ -251,6 +254,7 @@ class InvalidAttribute(Invalid):
|
||||
|
||||
|
||||
class VolumeUnattached(Invalid):
|
||||
ec2_code = 'IncorrectState'
|
||||
msg_fmt = _("Volume %(volume_id)s is not attached to anything")
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user