Proposed work-around of Cinder source code to allow deleting of volume attached to the already-deleted VM:
In the function cinder.volume.api.API.delete(), there exists an if-clause as follows:
if volume['attach_status'] == "attached": MY_LOG.debug("%s - API::delete - Volume is still attached, "\ "need to detach first" % __name__)
# Volume is still attached, need to detach first
raise exception.VolumeAttached(volume_id=volume_id)
Based on the above if-clause, it's possible to add further code to check if volume['instance_uuid'] results in a non-existed instance, then the deleting operation is still passed through.
The question is how to check if some instance_uuid exists or not from Cinder side?
Proposed work-around of Cinder source code to allow deleting of volume attached to the already-deleted VM:
In the function cinder. volume. api.API. delete( ), there exists an if-clause as follows:
if volume[ 'attach_ status' ] == "attached":
MY_ LOG.debug( "%s - API::delete - Volume is still attached, "\
"need to detach first" % __name__)
# Volume is still attached, need to detach first VolumeAttached( volume_ id=volume_ id)
raise exception.
Based on the above if-clause, it's possible to add further code to check if volume[ 'instance_ uuid'] results in a non-existed instance, then the deleting operation is still passed through.
The question is how to check if some instance_uuid exists or not from Cinder side?