nova/nova/tests/functional/libvirt
Stephen Finucane ce95af2caf Don't unset Instance.old_flavor, new_flavor until necessary
Since change Ia6d8a7909081b0b856bd7e290e234af7e42a2b38, the resource
tracker's 'drop_move_claim' method has been capable of freeing up
resource usage. However, this relies on accurate resource reporting.
It transpires that there's a race whereby the resource tracker's
'update_available_resource' periodic task can end up not accounting for
usage from migrations that are in the process of being completed. The
root cause is the resource tracker's reliance on the stashed flavor in a
given migration record [1]. Previously, this information was deleted by
the compute manager at the start of the confirm migration operation [2].
The compute manager would then call the virt driver [3], which could
take a not insignificant amount of time to return, before finally
dropping the move claim. If the periodic task ran between the clearing
of the stashed flavor and the return of the virt driver, it would find a
migration record with no stashed flavor and would therefore ignore this
record for accounting purposes [4], resulting in an incorrect record for
the compute node, and an exception when the 'drop_move_claim' attempts
to free up the resources that aren't being tracked.

The solution to this issue is pretty simple. Instead of unsetting the
old flavor record from the migration at the start of the various move
operations, do it afterwards.

[1] https://github.com/openstack/nova/blob/6557d67/nova/compute/resource_tracker.py#L1288
[2] https://github.com/openstack/nova/blob/6557d67/nova/compute/manager.py#L4310-L4315
[3] https://github.com/openstack/nova/blob/6557d67/nova/compute/manager.py#L4330-L4331
[4] https://github.com/openstack/nova/blob/6557d67/nova/compute/resource_tracker.py#L1300

Change-Id: I4760b01b695c94fa371b72216d398388cf981d28
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Partial-Bug: #1879878
Related-Bug: #1834349
Related-Bug: #1818914
(cherry picked from commit 44376d2e21)
2020-09-11 17:23:07 +01:00
..
__init__.py tests: introduce a NUMAServersTest class 2015-04-16 11:43:53 -04:00
base.py libvirt: Don't delete disks on shared storage during evacuate 2020-06-10 00:05:07 +00:00
integrated_helpers.py Extract new base class for provider usage functional tests 2019-08-21 15:06:20 +01:00
test_evacuate.py libvirt: Don't delete disks on shared storage during evacuate 2020-06-10 00:05:07 +00:00
test_numa_servers.py Don't unset Instance.old_flavor, new_flavor until necessary 2020-09-11 17:23:07 +01:00
test_pci_sriov_servers.py functional: Add unified '_build_server' helper function 2020-01-15 10:31:24 +00:00
test_report_cpu_traits.py libvirt: Use domain capabilities to get supported device models 2020-03-24 17:28:09 +00:00
test_reshape.py Functional test with pGPUs 2020-04-09 17:54:31 +02:00
test_rt_servers.py functional: Add '_create_server' helper 2020-01-20 14:32:43 +00:00
test_shared_resource_provider.py functional: Add '_create_server' helper 2020-01-20 14:32:43 +00:00
test_vgpu.py Allocate mdevs when resizing or reverting resize 2020-04-20 14:48:16 +02:00
test_vpmem.py functional: Add '_create_server' helper 2020-01-20 14:32:43 +00:00