Return HTTP 400 if volume size is not defined
Nova API properly checks that in case of booting from a image to volume bdm the client shall specify the size of the created volume. However the API does not handle the exception properly and returns HTTP 500. This patch handles the InvalidBDM exception and returns HTTP 400. Change-Id: I80d0aa64885f25081dad91b1f45da5b318d8ae25 Closes-bug: #1538197
This commit is contained in:
parent
440f2a834f
commit
5cad74c27b
|
@ -672,6 +672,7 @@ class ServersController(wsgi.Controller):
|
|||
exception.NetworkRequiresSubnet,
|
||||
exception.NetworkNotFound,
|
||||
exception.NetworkDuplicated,
|
||||
exception.InvalidBDM,
|
||||
exception.InvalidBDMSnapshot,
|
||||
exception.InvalidBDMVolume,
|
||||
exception.InvalidBDMImage,
|
||||
|
|
|
@ -3244,6 +3244,13 @@ class ServersControllerCreateTest(test.TestCase):
|
|||
self.controller.create,
|
||||
self.req, body=self.body)
|
||||
|
||||
@mock.patch.object(compute_api.API, 'create',
|
||||
side_effect=exception.InvalidBDM)
|
||||
def test_create_instance_raise_invalid_bdm(self, mock_create):
|
||||
self.assertRaises(webob.exc.HTTPBadRequest,
|
||||
self.controller.create,
|
||||
self.req, body=self.body)
|
||||
|
||||
@mock.patch.object(compute_api.API, 'create',
|
||||
side_effect=exception.ImageBadRequest(
|
||||
image_id='dummy', response='dummy'))
|
||||
|
|
Loading…
Reference in New Issue