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.
Change-Id: I1f4b3540dd453650f94333b36d7504ba164192f7
Closes-Bug: #1794996
(cherry picked from commit 05cd8d128211adbbfb3cf5d626034ccd0f75a452)
(cherry picked from commit 0208d64397731afa829bc08cd7b3b6494f0f05d5)
Reviewed: https:/ /review. openstack. org/623355 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=6c7e53e2105 9f80325d728cf7d ee2766da7a9471
Committed: https:/
Submitter: Zuul
Branch: stable/queens
commit 6c7e53e21059f80 325d728cf7dee27 66da7a9471
Author: Matt Riedemann <email address hidden>
Date: Fri Sep 28 11:18:14 2018 -0400
Fix InstanceNotFound during _destroy_ evacuated_ instances
The _destroy_ evacuated_ instances method on compute Found error that kills the startup of the
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
InstanceNot
compute service.
This change does two things in the _destroy_ evacuated_ instances
method:
1. Loads the evacuated instances with a read_deleted='yes' on_driver( ). This on_driver( ) is already get_by_ filters
InstanceNotFoun d while lazy-loading fields on the instance.
context when calling _get_instances_
should be fine since _get_instances_
returning deleted instances anyway (InstanceList.
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
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.
Change-Id: I1f4b3540dd4536 50f94333b36d750 4ba164192f7 bfb3cf5d626034c cd0f75a452) a829bc08cd7b3b6 494f0f05d5)
Closes-Bug: #1794996
(cherry picked from commit 05cd8d128211adb
(cherry picked from commit 0208d64397731af