Merge "Improve error log when snapshot fails" into stable/train

This commit is contained in:
Zuul 2021-04-17 01:08:46 +00:00 committed by Gerrit Code Review
commit 366f938ac5
3 changed files with 12 additions and 0 deletions

View File

@ -620,6 +620,11 @@ class ImageBadRequest(Invalid):
"%(response)s") "%(response)s")
class ImageQuotaExceeded(NovaException):
msg_fmt = _("Quota exceeded or out of space for image %(image_id)s "
"in the image service.")
class InstanceUnacceptable(Invalid): class InstanceUnacceptable(Invalid):
msg_fmt = _("Instance %(instance_id)s is unacceptable: %(reason)s") msg_fmt = _("Instance %(instance_id)s is unacceptable: %(reason)s")

View File

@ -938,6 +938,8 @@ def _translate_image_exception(image_id, exc_value):
if isinstance(exc_value, glanceclient.exc.BadRequest): if isinstance(exc_value, glanceclient.exc.BadRequest):
return exception.ImageBadRequest(image_id=image_id, return exception.ImageBadRequest(image_id=image_id,
response=six.text_type(exc_value)) response=six.text_type(exc_value))
if isinstance(exc_value, glanceclient.exc.HTTPOverLimit):
return exception.ImageQuotaExceeded(image_id=image_id)
return exc_value return exc_value

View File

@ -305,6 +305,11 @@ class TestExceptionTranslations(test.NoDBTestCase):
out_exc = glance._translate_image_exception('123', in_exc) out_exc = glance._translate_image_exception('123', in_exc)
self.assertIsInstance(out_exc, exception.ImageNotFound) self.assertIsInstance(out_exc, exception.ImageNotFound)
def test_client_httpoverlimit_converts_to_imagequotaexceeded(self):
in_exc = glanceclient.exc.HTTPOverLimit('123')
out_exc = glance._translate_image_exception('123', in_exc)
self.assertIsInstance(out_exc, exception.ImageQuotaExceeded)
class TestGlanceSerializer(test.NoDBTestCase): class TestGlanceSerializer(test.NoDBTestCase):
def test_serialize(self): def test_serialize(self):