Make exception handling in get_image_metadata more specific
The generic try/except with Exception was masking an AttributeError raised during migration flows in conductor. This change makes the error handling specific to the translated exceptions raised from the image service in nova.image.glance, specifically the _translate_image_exception method. Related-Bug: #1326926 Change-Id: I3e4db73569fc1b02d7a05b4ab10fe83fec956922
This commit is contained in:
@@ -203,7 +203,9 @@ def get_image_metadata(context, image_api, image_id_or_uri, instance):
|
||||
# If the base image is still available, get its metadata
|
||||
try:
|
||||
image = image_api.get(context, image_id_or_uri)
|
||||
except Exception as e:
|
||||
except (exception.ImageNotAuthorized,
|
||||
exception.ImageNotFound,
|
||||
exception.Invalid) as e:
|
||||
LOG.warning(_("Can't access image %(image_id)s: %(error)s"),
|
||||
{"image_id": image_id_or_uri, "error": e},
|
||||
instance=instance)
|
||||
|
||||
Reference in New Issue
Block a user