API: Rearrange HTTPBadRequest raising in _resize
This patch aimed to fix AutoDiskConfigDisabledByImage exception is excpeced for 2 times, besides, rearrange HTTPBadRequest to group them around each other for easy reading. P.S. Don't touch any logic so no UT need to be added/changed. Closes-Bug: #1538411 Change-Id: I2088322681edd4a3190047560ea99d31c5f3a551
This commit is contained in:
parent
440f2a834f
commit
b08e6e7a83
|
@ -902,15 +902,6 @@ class ServersController(wsgi.Controller):
|
|||
except exception.QuotaError as error:
|
||||
raise exc.HTTPForbidden(
|
||||
explanation=error.format_message())
|
||||
except exception.FlavorNotFound:
|
||||
msg = _("Unable to locate requested flavor.")
|
||||
raise exc.HTTPBadRequest(explanation=msg)
|
||||
except exception.CannotResizeToSameFlavor:
|
||||
msg = _("Resize requires a flavor change.")
|
||||
raise exc.HTTPBadRequest(explanation=msg)
|
||||
except (exception.CannotResizeDisk,
|
||||
exception.AutoDiskConfigDisabledByImage) as e:
|
||||
raise exc.HTTPBadRequest(explanation=e.format_message())
|
||||
except exception.InstanceIsLocked as e:
|
||||
raise exc.HTTPConflict(explanation=e.format_message())
|
||||
except exception.InstanceInvalidState as state_error:
|
||||
|
@ -924,8 +915,11 @@ class ServersController(wsgi.Controller):
|
|||
msg = _("Image that the instance was started "
|
||||
"with could not be found.")
|
||||
raise exc.HTTPBadRequest(explanation=msg)
|
||||
except (exception.NoValidHost,
|
||||
exception.AutoDiskConfigDisabledByImage) as e:
|
||||
except (exception.AutoDiskConfigDisabledByImage,
|
||||
exception.CannotResizeDisk,
|
||||
exception.CannotResizeToSameFlavor,
|
||||
exception.FlavorNotFound,
|
||||
exception.NoValidHost) as e:
|
||||
raise exc.HTTPBadRequest(explanation=e.format_message())
|
||||
except exception.Invalid:
|
||||
msg = _("Invalid instance image.")
|
||||
|
|
Loading…
Reference in New Issue