Comment 2 for bug 1916980

Revision history for this message
Gorka Eguileor (gorka) wrote :

I'm looking at the code and there seem to be 2 bugs in that part of the code, both of them will happen with all drivers. These issues happen in `cinder.volume.api.API.attachment_delete`

The notification issue happens for two reasons:

- We are mixing OVO and DB calls, so when we use DB methods directly they don't know about the existence of the OVO so its fields don't get updated. The proper solution is to fix that OVO and DB calls mix and make everything OVO calls.
- We are calling the notification too soon, since we are also changing the volume's status after the notification has been sent.

The other issue I see in the code is that we are calling DB method `volume_detached` which modifies the volume object itself, and API method `attachment_delete` then goes and modifies it as well ignoring any changes that the DB method may have done. Once again the solution is is only using OVO methods that update the reference and also taking into account changes made by `volume_detached` DB method.