Avoid API conflicting operations in parallel
Currently when we attach/detach volume and network interface from instance,
the task state of the instance is unchanged, it cause some issues.
1. In some API concurrent requests scenarios the operation results are
unpredictable and inconclusive, for example: do the concurrent operation
rebuilding-
task_state of instance isn't set when detaching volume,
@check_
and detaching-volume on one instance at the same time. It cause the
unpredictable result, sometimes the operations were successful, but
sometimes it would be fails according to the time sequence of concurrent
operations. We should do these tasks one by one.
Think about the following failed case:
1. start to detach volume from instance in nova-api
2. start to rebuild instance in nova-api, get the instance bdms from db,
because the detaching volume don't finish, so the bdms contain the
volume that will be detached.
3. start to detach volume from instance in nova-compute, and detaching
finish successfully, the bdm of this volume is destroyed.
4. start to rebuild the instance in nova-compute, try to detach all the
volumes according to the bdms that pass through from nova-api and
contain the volume had been detached. That would be failed, because
the bdm of the volume can't be found. Exception VolumeBDMNotFound was
raised.
5. rebuilding failed, the instance is set to ERROR.
This blueprint try to fix these issue on API rebuild/
Whiteboard
Gerrit topic: https:/
Addressed by: https:/
Avoid API conflicting operations in parallel
Replace by https:/
-- RuiChen 2015-12-03