nova/nova/tests/unit/compute
Matthew Booth 4b53e4edf9 Ensure attachment cleanup on failure in driver.pre_live_migration
Previously, if the call to driver.pre_live_migration failed (which in
libvirt can happen with a DestinationDiskExists exception), the
compute manager wouldn't rollback/cleanup volume attachments, leading
to corrupt volume attachment information, and, depending on the
backend, the instance being unable to access its volume. This patch
moves the driver.pre_live_migration call inside the existing
try/except, allowing the compute manager to properly rollback/cleanup
volume attachments.

The compute manager has its own _rollback_live_migration() cleanup in
case the pre_live_migration() RPC call to the destination fails. There
should be no conflicts between the cleanup in that and the new volume
cleanup in the except block. The remove_volume_connection() ->
driver_detach() -> detach_volume() call catches the InstanceNotFound
exception and warns about the instance disappearing (it was never
really on the destination in the first place). The attachment_delete()
in _rollback_live_migration() is contingent on there being an
old_vol_attachment in migrate_data, which there isn't because
pre_live_migration() raised instead of returning.

Conflicts in nova/compute/manager.py due to absence of setting
migrate_data.wait_for_vif_plug from 5aadff75c3.

Change-Id: I67f66e95d69ae6df22e539550a3eac697ea8f5d8
Closes-bug: 1778206
(cherry picked from commit 1a29248d5e)
(cherry picked from commit 6aecf475db)
2018-10-23 14:33:16 -04:00
..
monitors Allow monitor plugins to set own metric object 2016-06-27 14:38:32 +05:30
__init__.py
eventlet_utils.py
fake_resource_tracker.py rt: explicitly pass compute node to _update() 2017-01-12 11:30:03 -08:00
test_claims.py rt: use a single ResourceTracker object instance 2017-01-16 14:09:25 -05:00
test_compute.py Move live_migration.pre.start to the start of the method 2018-10-23 10:32:06 -04:00
test_compute_api.py Merge "Update RequestSpec.flavor on resize_revert" into stable/queens 2018-09-29 07:54:21 +00:00
test_compute_cells.py Fix host validity check for live-migration 2018-08-09 16:31:58 +05:30
test_compute_mgr.py Ensure attachment cleanup on failure in driver.pre_live_migration 2018-10-23 14:33:16 -04:00
test_compute_utils.py Bump compute RPC API to version 5.0 2018-02-08 10:43:56 -08:00
test_compute_xen.py Make xen unit tests work with os-xenapi>=0.3.0 2017-09-05 16:06:31 -04:00
test_flavors.py Make compute unit tests inherit from test.NoDBTestCase 2015-02-24 17:54:29 +02:00
test_host_api.py Make nova service-list use scatter-gather routine 2018-06-29 12:22:37 +00:00
test_instance_list.py Make nova list and migration-list ignore down cells 2018-06-26 18:44:47 +02:00
test_keypairs.py Transform keypair.import notification 2017-10-30 16:44:29 -04:00
test_multi_cell_list.py Some nit fix in multi_cell_list 2017-12-13 14:27:20 +08:00
test_provider_tree.py ProviderTree.get_provider_uuids: Top-down ordering 2018-01-31 08:35:35 -06:00
test_resource_tracker.py Change consecutive build failure limit to a weigher 2018-06-07 07:17:51 -07:00
test_rpcapi.py Compute RPC client bump to 5.0 2018-02-08 12:10:04 -08:00
test_shelve.py Fix shelving a paused instance 2018-05-20 22:11:04 +00:00
test_stats.py Change consecutive build failure limit to a weigher 2018-06-07 07:17:51 -07:00
test_virtapi.py Fix cancel_all_events event name parsing 2018-08-21 11:04:00 -07:00