Skip to content

Conversation

deepssin
Copy link
Contributor

In some OpenStack deployments, the server JSON includes 'attached_volumes'
instead of os-extended-volumes:volumes_attached. The existing
get_volumes function only checked the latter, which caused it to always
return an empty list on these clouds.

This patch updates get_volumes() to:

  • Safely access self.info without breaking
  • Fallback to 'attached_volumes' if 'os-extended-volumes:volumes_attached'
    is not present
  • Return the list of volume UUIDs consistently

With this change, teardown logic (volume cleanup on destroy) works
correctly across both types of openstack responses.

@deepssin deepssin requested review from zmc and VallariAg September 15, 2025 16:34
@deepssin deepssin requested a review from a team as a code owner September 15, 2025 16:34
volumes = self['os-extended-volumes:volumes_attached']
return [volume['id'] for volume in volumes ]
info = self.info or {}
#Some clouds use attached_volumes instead of os-extended-volumes:volumes_attached
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop this comment, the code below is pretty straightforward. It's better give this explanation in the commit description.

Some clouds use attached_volumes instead of os-extended-volumes:volumes_attached
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants