nova/nova/compute
Matt Riedemann fb61e864b9 Fix InstanceNotFound during _destroy_evacuated_instances
The _destroy_evacuated_instances method on compute
startup tries to cleanup guests on the hypervisor and
allocations held against that compute node resource
provider by evacuated instances, but doesn't take into
account that those evacuated instances could have been
deleted in the meantime which leads to a lazy-load
InstanceNotFound error that kills the startup of the
compute service.

This change does two things in the _destroy_evacuated_instances
method:

1. Loads the evacuated instances with a read_deleted='yes'
   context when calling _get_instances_on_driver(). This
   should be fine since _get_instances_on_driver() is already
   returning deleted instances anyway (InstanceList.get_by_filters
   defaults to read deleted instances unless the filters tell
   it otherwise - which we don't in this case). This is needed
   so that things like driver.destroy() don't raise
   InstanceNotFound while lazy-loading fields on the instance.

2. Skips the call to remove_allocation_from_compute() if the
   evacuated instance is already deleted. If the instance is
   already deleted, its allocations should have been cleaned
   up by its hosting compute service (or the API).

The functional regression test is updated to show the bug is
now fixed.

Conflicts:
      nova/compute/manager.py

NOTE(mriedem): The conflict is due to not having change
I1073faca6760bff3da0aaf3e8357bd8e64854be3 in Pike.

Change-Id: I1f4b3540dd453650f94333b36d7504ba164192f7
Closes-Bug: #1794996
(cherry picked from commit 05cd8d1282)
(cherry picked from commit 0208d64397)
(cherry picked from commit 6c7e53e210)
2018-12-06 19:39:34 -05: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 "Enforce case-sensitive hostnames in aggregate host add" into stable/pike 2018-10-24 22:35:40 +00:00
build_results.py Compute Add build_instance hook in compute manager 2014-12-04 10:12:00 -05:00
cells_api.py Remove check_detach 2017-07-20 22:32:52 +02:00
claims.py Remove translation of log messages 2017-06-09 09:06:16 +00:00
flavors.py Merge "Replace flavors.get_all_flavors_sorted_list() with object call" 2016-10-18 12:13:09 +00:00
instance_actions.py Add ability to signal and perform online volume size change 2017-07-12 11:53:20 -04:00
manager.py Fix InstanceNotFound during _destroy_evacuated_instances 2018-12-06 19:39:34 -05:00
power_state.py Removed enum duplication from nova.compute 2016-09-02 07:30:44 +00:00
provider_tree.py placement: adds ProviderTree for nested resources 2017-06-26 11:33:38 +01:00
resource_tracker.py Make ResourceTracker.stats node-specific 2018-08-07 15:45:05 -04:00
rpcapi.py conf: remove *_topic config opts 2017-07-17 21:27:02 -07:00
stats.py Change consecutive build failure limit to a weigher 2018-06-14 07:32:36 -07:00
task_states.py Removed enum duplication from nova.compute 2016-09-02 07:30:44 +00:00
utils.py Handle deleted instances when refreshing the info_cache 2017-09-21 13:51:25 +00:00
vm_states.py Removed enum duplication from nova.compute 2016-09-02 07:30:44 +00:00