Ooops looks like this is a bit trickier than I thought, since check_attach and check_detach and check_detach are actually not exposed in the API.
The best solution would be to completely drop those two calls from nova as they are inherently racy (the result is outdated as soon as we get it). and make sure that reserve_volume (already does) and begin_detaching error out when the status is not as expected, so it will require some cinder work as well.
Ooops looks like this is a bit trickier than I thought, since check_attach and check_detach and check_detach are actually not exposed in the API.
The best solution would be to completely drop those two calls from nova as they are inherently racy (the result is outdated as soon as we get it). and make sure that reserve_volume (already does) and begin_detaching error out when the status is not as expected, so it will require some cinder work as well.