It should be noted that this was found during backporting of https://review.openstack.org/#/c/545132/ to stable/pike where we don't have this code to set the bdm.attachment_id:
https://github.com/openstack/nova/blob/stable/queens/nova/compute/api.py#L3765
This is also a problem for rocky/queens if there are older computes in the deployment.
So the delete code path needs to handle the case that the bdm in the build request doesn't have an attachment_id field set and ignore it, like:
if 'attachment_id' in bdm and bdm.attachment_id: volume_api.delete_attachment(...) else: # do the old volume cleanup thing
It should be noted that this was found during backporting of https:/ /review. openstack. org/#/c/ 545132/ to stable/pike where we don't have this code to set the bdm.attachment_id:
https:/ /github. com/openstack/ nova/blob/ stable/ queens/ nova/compute/ api.py# L3765
This is also a problem for rocky/queens if there are older computes in the deployment.
So the delete code path needs to handle the case that the bdm in the build request doesn't have an attachment_id field set and ignore it, like:
if 'attachment_id' in bdm and bdm.attachment_id: api.delete_ attachment( ...)
volume_
else:
# do the old volume cleanup thing