catch InstanceInvalidState in more places

Further fixes to bug 911879

500s or 400s are returned in the OS API when actions are denied due
to being in an invalid state.  409 should be returned, instead.  A
previous review (2846) fixed the delete case and this fixes more.

When writing tests, I found a number of exceptions that are not raised
anymore, and they were being incorrectly used in tests still.  I fixed
those up.

Change-Id: I0d5b1ed52e0cc9766be8e2a7de84c8601f4bdf26
This commit is contained in:
Chris Behrens
2012-01-11 20:25:23 -08:00
parent 959d61899a
commit eb5d536161

View File

@@ -91,10 +91,6 @@ class ApiError(Error):
super(ApiError, self).__init__(outstr)
class RebuildRequiresActiveInstance(Error):
pass
class DBError(Error):
"""Wraps an implementation specific exception."""
def __init__(self, inner_exception=None):
@@ -211,18 +207,6 @@ class PolicyNotAllowed(NotAuthorized):
message = _("Policy Doesn't allow %(action)s to be performed.")
class InstanceBusy(NovaException):
message = _("Instance %(instance_id)s is busy. (%(task_state)s)")
class InstanceSnapshotting(InstanceBusy):
message = _("Instance %(instance_uuid)s is currently snapshotting.")
class InstanceBackingUp(InstanceBusy):
message = _("Instance %(instance_uuid)s is currently being backed up.")
class Invalid(NovaException):
message = _("Unacceptable parameters.")