Remove unnecessary DB read
Attachment OVO automatically loads the Volume OVO into its `volume`
attribute, so we don't need to load it again in the volume's API
`attachment_delete` method.
@@ -2263,7 +2263,7 @@ class API(base.Base):
def attachment_delete(self, ctxt, attachment):
ctxt.authorize(attachment_policy.DELETE_POLICY,
target_obj=attachment)
- volume = objects.Volume.get_by_id(ctxt, attachment.volume_id)
+ volume = attachment.volume
if attachment.attach_status == fields.VolumeAttachStatus.RESERVED:
self.db.volume_detached(ctxt.elevated(), attachment.volume_id,
attachment.get('id'))
