diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py index 708dddd074fe..707192e6fd3a 100644 --- a/nova/api/openstack/compute/servers.py +++ b/nova/api/openstack/compute/servers.py @@ -731,6 +731,7 @@ class ServersController(wsgi.Controller): exception.FlavorNotFound, exception.InvalidMetadata, exception.InvalidVolume, + exception.VolumeNotFound, exception.MismatchVolumeAZException, exception.MultiplePortsNotApplicable, exception.InvalidFixedIpAndMaxCountRequest, diff --git a/nova/tests/unit/api/openstack/compute/test_servers.py b/nova/tests/unit/api/openstack/compute/test_servers.py index 8b28d1b924e6..fa4fcd511bac 100644 --- a/nova/tests/unit/api/openstack/compute/test_servers.py +++ b/nova/tests/unit/api/openstack/compute/test_servers.py @@ -6957,6 +6957,14 @@ class ServersControllerCreateTestWithMock(test.TestCase): self.assertRaises(webob.exc.HTTPBadRequest, self._test_create_extra, {}) + @mock.patch.object( + compute_api.API, 'create', + side_effect=exception.VolumeNotFound(volume_id='foo')) + def test_create_instance_with_volume_not_found_error(self, create_mock): + # Tests that InvalidVolume is translated to a 400 error. + self.assertRaises( + webob.exc.HTTPBadRequest, self._test_create_extra, {}) + class ServersViewBuilderTest(test.TestCase): project_id = fakes.FAKE_PROJECT_ID