nova/nova/tests/functional
Stephen Finucane dc9c7a5ebf Move revert resize under semaphore
As discussed in change I26b050c402f5721fc490126e9becb643af9279b4, the
resource tracker's periodic task is reliant on the status of migrations
to determine whether to include usage from these migrations in the
total, and races between setting the migration status and decrementing
resource usage via 'drop_move_claim' can result in incorrect usage.
That change tackled the confirm resize operation. This one changes the
revert resize operation, and is a little trickier due to kinks in how
both the same-cell and cross-cell resize revert operations work.

For same-cell resize revert, the 'ComputeManager.revert_resize'
function, running on the destination host, sets the migration status to
'reverted' before dropping the move claim. This exposes the same race
that we previously saw with the confirm resize operation. It then calls
back to 'ComputeManager.finish_revert_resize' on the source host to boot
up the instance itself. This is kind of weird, because, even ignoring
the race, we're marking the migration as 'reverted' before we've done
any of the necessary work on the source host.

The cross-cell resize revert splits dropping of the move claim and
setting of the migration status between the source and destination host
tasks. Specifically, we do cleanup on the destination and drop the move
claim first, via 'ComputeManager.revert_snapshot_based_resize_at_dest'
before resuming the instance and setting the migration status on the
source via
'ComputeManager.finish_revert_snapshot_based_resize_at_source'. This
would appear to avoid the weird quirk of same-cell migration, however,
in typical weird cross-cell fashion, these are actually different
instances and different migration records.

The solution is once again to move the setting of the migration status
and the dropping of the claim under 'COMPUTE_RESOURCE_SEMAPHORE'. This
introduces the weird setting of migration status before completion to
the cross-cell resize case and perpetuates it in the same-cell case, but
this seems like a suitable compromise to avoid attempts to do things
like unplugging already unplugged PCI devices or unpinning already
unpinned CPUs. From an end-user perspective, instance state changes are
what really matter and once a revert is completed on the destination
host and the instance has been marked as having returned to the source
host, hard reboots can help us resolve any remaining issues.

Change-Id: I29d6f4a78c0206385a550967ce244794e71cef6d
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Closes-Bug: #1879878
2020-09-03 08:55:55 +00:00
..
api api: Add microversion for extra spec validation 2020-04-08 13:20:02 +00:00
api_sample_tests Remove six.PY2 and six.PY3 2020-08-15 07:45:23 +00:00
compute Provider Config File: Coding style and test cases improvement 2020-09-01 01:05:34 +00:00
db Merge "tests: Remove 'test_servers.ServersTestBase'" 2020-07-24 09:24:53 +00:00
libvirt Don't unset Instance.old_flavor, new_flavor until necessary 2020-09-01 16:19:27 +01:00
notification_sample_tests Remove six.reraise 2020-08-15 07:45:49 +00:00
regressions Move revert resize under semaphore 2020-09-03 08:55:55 +00:00
wsgi Merge "tests: Add helpers for suspend, resume and reboot of server" 2020-08-24 17:43:03 +00:00
__init__.py Eventlet monkey patching should be as early as possible 2019-03-22 09:27:16 +00:00
api_paste_fixture.py Remove future imports 2020-03-24 15:05:36 +00:00
api_samples_test_base.py tests: Define constants in '_IntegratedTestBase' 2020-07-16 17:58:36 +01:00
fixtures.py Remove future imports 2020-03-24 15:05:36 +00:00
integrated_helpers.py Move revert resize under semaphore 2020-09-03 08:55:55 +00:00
test_aggregates.py func tests: move _run_periodics() into base class 2020-03-24 10:10:53 -04:00
test_availability_zones.py functional: Add unified '_build_server' helper function 2020-01-15 10:31:24 +00:00
test_boot_from_volume.py func: Add CinderFixture to _IntegratedTestBase 2020-08-03 20:41:18 +01:00
test_cold_migrate.py Use COMPUTE_SAME_HOST_COLD_MIGRATE trait during migrate 2020-01-29 09:44:47 +00:00
test_compute_mgr.py Remove future imports 2020-03-24 15:05:36 +00:00
test_conf_max_attach_disk_devices.py func: Add CinderFixture to _IntegratedTestBase 2020-08-03 20:41:18 +01:00
test_cross_az_attach.py functional: Add unified '_build_server' helper function 2020-01-15 10:31:24 +00:00
test_cross_cell_migrate.py Ensure source compute is up when confirming a resize 2020-08-26 14:50:07 +01:00
test_external_networks.py functional: Add unified '_build_server' helper function 2020-01-15 10:31:24 +00:00
test_flavor_extraspecs.py Follow-up for flavor-extra-spec-validators series 2020-04-08 14:21:13 +01:00
test_images.py tests: Remove 'test_servers.ServersTestBase' 2020-07-16 17:58:37 +01:00
test_instance_actions.py tests: Remove 'test_servers.ServersTestBase' 2020-07-16 17:58:37 +01:00
test_json_filter.py functional: Add unified '_build_server' helper function 2020-01-15 10:31:24 +00:00
test_legacy_v2_compatible_wrapper.py functional: Move single-use function to its caller 2020-08-19 18:07:25 +01:00
test_list_servers_ip_filter.py trivial: Change name of network provided by NeutronFixture 2019-10-05 15:40:28 +01:00
test_login.py update api_samples code to use better variables 2015-12-14 11:23:26 +08:00
test_metadata.py Remove future imports 2020-03-24 15:05:36 +00:00
test_middleware.py tests: Define constants in '_IntegratedTestBase' 2020-07-16 17:58:36 +01:00
test_multiattach.py func: Add CinderFixture to _IntegratedTestBase 2020-08-03 20:41:18 +01:00
test_nova_manage.py functional: Drop '_api' suffix from placement fixture 2020-08-19 18:07:25 +01:00
test_policy.py Follow-ups for host_status:unknown-only policy rule 2020-03-16 17:18:28 +00:00
test_report_client.py Stop using PlacementDirect 2020-03-05 07:36:37 -06:00
test_scheduler.py func tests: move _run_periodics() into base class 2020-03-24 10:10:53 -04:00
test_server_external_events.py functional: Add unified '_build_server' helper function 2020-01-15 10:31:24 +00:00
test_server_faults.py functional: Add unified '_build_server' helper function 2020-01-15 10:31:24 +00:00
test_server_group.py Merge "Update scheduler instance info at confirm resize" 2020-05-16 00:19:46 +00:00
test_server_rescue.py api: Introduce microverion 2.87 allowing boot from volume rescue 2020-04-09 08:39:36 +01:00
test_servers.py Cyborg evacuate support 2020-09-01 08:41:45 +00:00
test_servers_provider_tree.py Merge "tests: Move single use constants to their callers" 2020-07-24 09:24:35 +00:00
test_service.py Reset the cell cache for database access in Service 2020-04-08 17:48:18 +00:00