When I try and detach cinder volumes in openstack they do not detach properly. They just get stuck in detaching.
The same thing happens if I delete an instance. The instance deletes fine but the volume does not get destroyed properly.
Here is what it shows in the log:
2023-05-24 14:49:37.090 4639 ERROR nova.volume.cinder [None req-1968ed99-1825-4ec5-9c7a-427a59d3b3d1 229aef0094cd40c8adf30f2ea52c45ba 7870e6677e5046ad9b8f14c3add78f30 - - default default] Delete attachment failed for attachment 9ff50030-6c62-4307-afed-4cc69dc6a223. Error: ConflictNovaUsingAttachment: Detach volume from instance 34626072-6cdf-4024-989e-d4889bb148e0 using the Compute API (HTTP 409) (Request-ID: req-df45046e-b52b-451a-856b-49b2d8a14dd0) Code: 409: cinderclient.exceptions.ClientException: ConflictNovaUsingAttachment: Detach volume from instance 34626072-6cdf-4024-989e-d4889bb148e0 using the Compute API (HTTP 409) (Request-ID: req-df45046e-b52b-451a-856b-49b2d8a14dd0)
I can manually fix this by:
running the following sql commands on the cinder database:
update volumes set attach_status='detached',status='available' where id ='';
update volume_attachment set attach_status='detached',deleted=1,detach_time=now() WHERE volume_id='';
delete from volume_attachment where deleted='1';
How do I solve this error and what does Error: ConflictNovaUsingAttachment mean?