nova/nova/compute
Stephen Finucane 44376d2e21 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
2020-09-01 16:19:27 +01:00
..
monitors Remove six.add_metaclass 2020-08-15 07:45:39 +00:00
__init__.py Remove nova.compute.*API() shims 2019-06-12 16:09:46 +01:00
api.py Ensure source compute is up when confirming a resize 2020-08-26 14:50:07 +01:00
build_results.py
claims.py objects: Add MigrationTypeField 2020-05-08 14:45:54 +01:00
flavors.py trivial: Remove dead code 2019-12-12 10:55:02 +00:00
instance_actions.py Add instance action record for snapshot instances 2017-12-11 17:46:38 +08:00
instance_list.py Plumbing for ignoring list_records_by_skipping_down_cells 2019-02-08 16:28:28 -05:00
manager.py Don't unset Instance.old_flavor, new_flavor until necessary 2020-09-01 16:19:27 +01:00
migration_list.py Refactor scatter-gather utility to return exception objects 2018-10-31 15:18:07 -04:00
multi_cell_list.py Remove six.add_metaclass 2020-08-15 07:45:39 +00:00
power_state.py Removed enum duplication from nova.compute 2016-09-02 07:30:44 +00:00
provider_config.py Provider Config File: Function to further validate and retrieve configs 2020-08-07 01:51:24 +00:00
provider_tree.py Add resources dict into _Provider 2019-09-13 08:50:35 +00:00
resource_tracker.py Provider Config File: Enable loading and merging of provider configs 2020-08-26 23:18:53 +08:00
rpcapi.py Update compute rpc version alias for ussuri 2020-04-14 16:08:44 +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 2018-09-12 13:05:29 +03:00
utils.py Use 'Exception.__traceback__' for versioned notifications 2020-06-08 14:38:33 +01:00
vm_states.py Removed enum duplication from nova.compute 2016-09-02 07:30:44 +00:00