]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commit
Fix possible race condition for accept transfer
authorZhiteng Huang <zhithuang@ebaysf.com>
Sun, 7 Sep 2014 17:22:52 +0000 (10:22 -0700)
committerZhiteng Huang <zhithuang@ebaysf.com>
Mon, 8 Sep 2014 15:54:52 +0000 (08:54 -0700)
commit7e95b05b937e632ae8aee82cfa8f6f31835e6316
treedaef476a37c548909b0166628f1fd1202ac29d6c
parent04abab869d28e007d9b869122740f70cd839daf7
Fix possible race condition for accept transfer

Accept transfer API workflow is currently like this:

  call volume_api.accept_transfer()
    |
    --- RPC cast to volume manager
          |
          --- volume manager calls volume driver accept_transfer()

  update volume's DB record

Given the non-blocking nature of RPC cast, what happens in volume
manager and volume driver can happen in parallel with the DB update.
If volume driver relies on original DB record to do things, then
DB record shouldn't be updated until volume driver finishes its job.

So this patch change volume RPC API accept_transfer() from cast
to call to make sure the workflow is in serialized manner.  Also
elevated the context when volume manager tries to update the DB
record when driver has done accept_transfer().

Change-Id: Ieae52e167aa02967338e0be5d78d570d682faa7a
Closes-bug: #1357432
cinder/tests/api/contrib/test_volume_transfer.py
cinder/tests/test_volume_rpcapi.py
cinder/tests/test_volume_transfer.py
cinder/volume/manager.py
cinder/volume/rpcapi.py