Improve error log when snapshot fails
If snapshot creation via glance fails due to lack of space or over quota, we want to have a clearer error message. Change-Id: Ic9133f6bc14d4fe766d37a438bf52c33e89da768 Closes-Bug: #1613770
This commit is contained in:
parent
2c6542948f
commit
024bf10d8a
@ -615,6 +615,11 @@ class ImageBadRequest(Invalid):
|
||||
"%(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):
|
||||
msg_fmt = _("Instance %(instance_id)s is unacceptable: %(reason)s")
|
||||
|
||||
|
@ -938,6 +938,8 @@ def _translate_image_exception(image_id, exc_value):
|
||||
if isinstance(exc_value, glanceclient.exc.BadRequest):
|
||||
return exception.ImageBadRequest(image_id=image_id,
|
||||
response=six.text_type(exc_value))
|
||||
if isinstance(exc_value, glanceclient.exc.HTTPOverLimit):
|
||||
return exception.ImageQuotaExceeded(image_id=image_id)
|
||||
return exc_value
|
||||
|
||||
|
||||
|
@ -305,6 +305,11 @@ class TestExceptionTranslations(test.NoDBTestCase):
|
||||
out_exc = glance._translate_image_exception('123', in_exc)
|
||||
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):
|
||||
def test_serialize(self):
|
||||
|
Loading…
Reference in New Issue
Block a user