Merge "Catch ImageNotAuthorized during boot instance" into stable/newton

This commit is contained in:
Jenkins 2017-02-15 04:15:29 +00:00 committed by Gerrit Code Review
commit ec8c78b7eb
2 changed files with 9 additions and 0 deletions

View File

@ -653,6 +653,7 @@ class ServersController(wsgi.Controller):
raise exc.HTTPBadRequest(explanation=msg)
except (exception.ImageNotActive,
exception.ImageBadRequest,
exception.ImageNotAuthorized,
exception.FixedIpNotFoundForAddress,
exception.FlavorNotFound,
exception.FlavorDiskTooSmall,

View File

@ -3241,6 +3241,14 @@ class ServersControllerCreateTest(test.TestCase):
self.assertRaises(webob.exc.HTTPBadRequest,
self._test_create_extra, {})
@mock.patch.object(compute_api.API, 'create',
side_effect=exception.ImageNotAuthorized(
project_id=FAKE_UUID))
def test_create_instance_with_image_not_authorized(self,
mock_create):
self.assertRaises(webob.exc.HTTPBadRequest,
self._test_create_extra, {})
@mock.patch.object(compute_api.API, 'create',
side_effect=exception.InstanceExists(
name='instance-name'))