Merge "Handling unexpected python error "NoneType object is not iterable""

This commit is contained in:
Zuul 2018-10-26 17:40:56 +00:00 committed by Gerrit Code Review
commit 143ba47f79
2 changed files with 8 additions and 0 deletions

View File

@ -727,6 +727,10 @@ class GlanceMetadataNotFound(NotFound):
message = _("Glance metadata for volume/snapshot %(id)s cannot be found.")
class ImageDownloadFailed(CinderException):
_msg_fmt = _("Failed to download image %(image_href)s, reason: %(reason)s")
class ExportFailure(Invalid):
message = _("Failed to export for volume: %(reason)s")

View File

@ -357,6 +357,10 @@ class GlanceImageService(object):
except Exception:
_reraise_translated_image_exception(image_id)
if image_chunks is None:
raise exception.ImageDownloadFailed(
image_href=context, reason=_('image contains no data.'))
if not data:
return image_chunks
else: