Merge "Fix attachment_delete for reserved case"
This commit is contained in:
commit
30431abf2a
@ -2003,7 +2003,12 @@ class API(base.Base):
|
|||||||
def attachment_delete(self, ctxt, attachment):
|
def attachment_delete(self, ctxt, attachment):
|
||||||
volume = objects.Volume.get_by_id(ctxt, attachment.volume_id)
|
volume = objects.Volume.get_by_id(ctxt, attachment.volume_id)
|
||||||
if attachment.attach_status == 'reserved':
|
if attachment.attach_status == 'reserved':
|
||||||
attachment.destroy()
|
self.db.volume_detached(ctxt.elevated(), attachment.volume_id,
|
||||||
|
attachment.get('id'))
|
||||||
|
self.db.volume_admin_metadata_delete(ctxt.elevated(),
|
||||||
|
attachment.volume_id,
|
||||||
|
'attached_mode')
|
||||||
|
volume_utils.notify_about_volume_usage(ctxt, volume, "detach.end")
|
||||||
else:
|
else:
|
||||||
self.volume_rpcapi.attachment_delete(ctxt,
|
self.volume_rpcapi.attachment_delete(ctxt,
|
||||||
attachment.id,
|
attachment.id,
|
||||||
|
Loading…
Reference in New Issue
Block a user