From 067cd93424ea1e62c77744986a5479d1b99b0ffe Mon Sep 17 00:00:00 2001 From: Lee Yarwood Date: Fri, 1 Oct 2021 12:21:57 +0100 Subject: 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 --- nova/virt/block_device.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'nova/virt/block_device.py') 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): -- cgit v1.2.1