diff options
author | Lee Yarwood <lyarwood@redhat.com> | 2021-10-01 12:21:57 +0100 |
---|---|---|
committer | Lee Yarwood <lyarwood@redhat.com> | 2021-12-03 12:07:33 +0000 |
commit | 067cd93424ea1e62c77744986a5479d1b99b0ffe (patch) | |
tree | d2ee3212a01b7cd077f53ce0cdd8d6a76fff1f65 /nova/virt/block_device.py | |
parent | 10c7e718488a6daad5bcea97e00aece24179168e (diff) | |
download | nova-067cd93424ea1e62c77744986a5479d1b99b0ffe.tar.gz |
block_device: Ignore VolumeAttachmentNotFound during detach
Bug #1937084 details a race condition within Cinder where requests to
delete an attachment and later delete the underlying volume can race
leading to the initial request returning a 404 if the volume delete
completes first.
This change attempts to handle this within Nova during a detach as we
ultimately don't care that the volume and/or volume attachment are no
longer available within Cinder. This allows Nova to complete its' own
cleanup of the BlockDeviceMapping record resulting in the volume no
longer appearing attached in Nova's APIs.
Closes-Bug: #1937084
Change-Id: I191552652d8ff5206abad7558c99bce27979dc84
Diffstat (limited to 'nova/virt/block_device.py')
-rw-r--r-- | nova/virt/block_device.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/nova/virt/block_device.py b/nova/virt/block_device.py index 8adffdaf9a..4a41703174 100644 --- a/nova/virt/block_device.py +++ b/nova/virt/block_device.py @@ -450,7 +450,18 @@ class DriverVolumeBlockDevice(DriverBlockDevice): volume_api.detach(context.elevated(), volume_id, instance.uuid, attachment_id) else: - volume_api.attachment_delete(context, self['attachment_id']) + try: + volume_api.attachment_delete(context, self['attachment_id']) + except exception.VolumeAttachmentNotFound: + LOG.info( + "Ignoring a volume attachment deletion failure as the " + "volume %(volume_id)s or the volume attachment " + "%(attachment_id)s disappeared during the request.", + { + 'volume_id': volume_id, + 'attachment_id': self['attachment_id'] + } + ) def detach(self, context, instance, volume_api, virt_driver, attachment_id=None, destroy_bdm=False): |