Browse Source

Merge "Handle an attached volume without volume_image_metadata"

changes/66/778366/3
Zuul 5 months ago
committed by Gerrit Code Review
parent
commit
15974baef7
  1. 13
      openstack_dashboard/dashboards/project/instances/tabs.py

13
openstack_dashboard/dashboards/project/instances/tabs.py

@ -41,12 +41,19 @@ class OverviewTab(tabs.Tab):
try:
volume = api.cinder.volume_get(
self.request, volume_id=instance.volumes[0].volumeId)
instance.image = {
'id': volume.volume_image_metadata['image_id'],
'name': volume.volume_image_metadata['image_name']}
except Exception:
exceptions.handle(self.request,
_('Failed to get attached volume.'))
try:
instance.image = {
'id': volume.volume_image_metadata['image_id'],
'name': volume.volume_image_metadata['image_name'],
}
except (AttributeError, KeyError):
# AttributeError is raised when volume_image_metadata does not
# exist. KeyError is raised when volume_image_metadata exists
# but image_id or image_name is not included.
instance.image = None
return {"instance": instance}

Loading…
Cancel
Save