nova/nova/tests/unit/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 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 Fix InstanceNotFound during _destroy_evacuated_instances 2018-12-06 19:39:34 -05:00
test_compute_api.py Merge "Fix host validity check for live-migration" into stable/pike 2018-10-02 16:57:09 +00:00
test_compute_cells.py Fix host validity check for live-migration 2018-08-09 17:26:27 +05:30
test_compute_mgr.py Fix InstanceNotFound during _destroy_evacuated_instances 2018-12-06 19:39:34 -05:00
test_compute_utils.py Handle deleted instances when refreshing the info_cache 2017-09-21 13:51:25 +00:00
test_compute_xen.py conf: Remove config option compute_ manager 2016-12-08 20:05:52 +08:00
test_flavors.py Make compute unit tests inherit from test.NoDBTestCase 2015-02-24 17:54:29 +02:00
test_host_api.py Merge "Cleanup RP and HM records while deleting a compute service." into stable/pike 2018-07-09 19:51:47 +00:00
test_keypairs.py Stop using mox stubs in test_keypairs.py 2017-06-26 14:50:40 +09:00
test_provider_tree.py placement: adds ProviderTree for nested resources 2017-06-26 11:33:38 +01:00
test_resource_tracker.py Change consecutive build failure limit to a weigher 2018-06-14 07:32:36 -07:00
test_rpcapi.py conf: remove *_topic config opts 2017-07-17 21:27:02 -07:00
test_shelve.py Fix shelving a paused instance 2018-05-20 21:25:46 +00:00
test_stats.py Change consecutive build failure limit to a weigher 2018-06-14 07:32:36 -07:00
test_virtapi.py Remove mox from nova/tests/unit/compute/test_virtapi.py 2016-11-28 08:52:00 +00:00