nova/nova/compute
Lee Yarwood b18e93a2a4 compute: Don't delete the original attachment during pre LM rollback
I0bfb11296430dfffe9b091ae7c3a793617bd9d0d introduced support for live
migration with cinderv3 volume attachments during Queens. This initial
support handled failures in pre_live_migration directly by removing any
attachments created on the destination and reverting to the original
attachment ids before re-raising the caught exception to the source
compute. It also added rollback code within the main
_rollback_live_migration method but missed that this would also be
called during a pre_live_migration rollback.

As a result after a failure in pre_live_migration
_rollback_live_migration will attempt to delete the source host volume
attachments referenced by the bdm before updating the bdms with the now
non-existent attachment ids, leaving the volumes in an `available` state
in Cinder as they have no attachment records associated with them
anymore.

This change aims to resolve this within _rollback_volume_bdms by
ensuring that the current and original attachment_ids are not equal
before requesting that the current attachment referenced by the bdm is
deleted. When called after a failure in pre_live_migration this should
result in no attempt being made to remove the original source host
attachments from Cinder.

Note that the following changes muddy the waters slightly here but
introduced no actual changes to the logic within
_rollback_live_migration:

* I0f3ab6604d8b79bdb75cf67571e359cfecc039d8 reworked some of the error
  handling in Rocky but isn't the source of the issue here.

* Ibe9215c07a1ee00e0e121c69bcf7ee1b1b80fae0 reworked
  _rollback_live_migration to use the provided source_bdms.

* I6bc73e8c8f98d9955f33f309beb8a7c56981b553 then refactored
  _rollback_live_migration, moving the logic into a self contained
  _rollback_volume_bdms method.

Closes-Bug: #1889108
Change-Id: I9edb36c4df1cc0d8b529e669f06540de71766085
(cherry picked from commit 2102f1834a)
(cherry picked from commit 034b2fa8fe)
(cherry picked from commit c6c3483a41)
(cherry picked from commit 6007c41aa8)
2020-09-14 10:20:11 +01:00
..
monitors Remove translation of log messages 2017-06-09 09:06:16 +00:00
__init__.py Switch to using oslo_* instead of oslo.* 2015-02-06 06:03:10 -05:00
api.py Merge "compute: Allow snapshots to be created from PAUSED volume backed instances" into stable/rocky 2020-08-26 04:14:49 +00:00
build_results.py Compute Add build_instance hook in compute manager 2014-12-04 10:12:00 -05:00
cells_api.py Fix missing marker functions 2018-01-25 03:37:48 +00:00
claims.py [Trivial] docstrings, typos, minor refactoring 2017-08-28 08:33:58 -05:00
flavors.py Remove unused flavor_delete_info() method 2018-08-03 12:44:52 -04:00
instance_actions.py Add instance action record for snapshot instances 2017-12-11 17:46:38 +08:00
instance_list.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
manager.py compute: Don't delete the original attachment during pre LM rollback 2020-09-14 10:20:11 +01:00
migration_list.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
multi_cell_list.py Make nova list and migration-list ignore down cells 2018-06-25 17:28:57 -04:00
power_state.py Removed enum duplication from nova.compute 2016-09-02 07:30:44 +00:00
provider_tree.py Perf: Use dicts for ProviderTree roots 2019-07-10 15:19:45 -05:00
resource_tracker.py rt: only map compute node if we created it 2019-08-13 17:07:53 -04:00
rpcapi.py compute: Use long_rpc_timeout in reserve_block_device_name 2019-12-02 20:15:46 +00:00
stats.py Change consecutive build failure limit to a weigher 2018-06-06 15:18:50 -07:00
task_states.py Fix resource tracker updates during instance evacuation 2019-03-05 19:22:14 +08:00
utils.py Replace non-nova server fault message 2019-08-06 11:35:58 -04:00
vm_states.py Removed enum duplication from nova.compute 2016-09-02 07:30:44 +00:00