When bug 1709902 was fixed in I0df401a7c91f012fdb25cb0e6b344ca51de8c309
the fix assumed that when the _destroy_evacuated_instances() is called
during the init of the nova-compute service the resource tracker
already knows the compute node ids associated to the given compute
host. This is not true and therefore _destroy_evacuated_instances fails
with and exception and does not clean up the evacuated instance.
The resource tracker's compute_nodes dict only initalized during the
first update_available_resource call that happens in the
pre_start_hook. While the _destroy_evacuate_instances called from
init_host which is called before the pre_hook_start.
The _destroy_evacuated_instances call uses the
_delete_allocation_for_moved_instance that relies on the resource
tracker's compute_nodes dict.
This patch inlines _delete_allocation_for_moved_instance in
_destroy_evacuated_instances and queries the db for the compute node
uuid. As ironic uses 1:M host:node setup we cannot ask the db only once
about the node uuid as different instances might be on different nodes.
NOTE(mriedem): A couple of changes had to be made to the compute
manager code since I0883c2ba1989c5d5a46e23bcbcda53598707bcbc is
not in stable/pike.
Reviewed: https:/ /review. openstack. org/512716 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=fb968e18b24 72b0dd7231ff324 4b683d59f04cd0
Committed: https:/
Submitter: Zuul
Branch: stable/pike
commit fb968e18b2472b0 dd7231ff3244b68 3d59f04cd0
Author: Balazs Gibizer <email address hidden>
Date: Thu Oct 12 16:07:28 2017 +0200
fix cleaning up evacuated instances
When bug 1709902 was fixed in I0df401a7c91f01 2fdb25cb0e6b344 ca51de8c309 evacuated_ instances( ) is called evacuated_ instances fails
the fix assumed that when the _destroy_
during the init of the nova-compute service the resource tracker
already knows the compute node ids associated to the given compute
host. This is not true and therefore _destroy_
with and exception and does not clean up the evacuated instance.
The resource tracker's compute_nodes dict only initalized during the available_ resource call that happens in the evacuate_ instances called from evacuated_ instances call uses the allocation_ for_moved_ instance that relies on the resource
first update_
pre_start_hook. While the _destroy_
init_host which is called before the pre_hook_start.
The _destroy_
_delete_
tracker's compute_nodes dict.
This patch inlines _delete_ allocation_ for_moved_ instance in evacuated_ instances and queries the db for the compute node
_destroy_
uuid. As ironic uses 1:M host:node setup we cannot ask the db only once
about the node uuid as different instances might be on different nodes.
NOTE(mriedem): A couple of changes had to be made to the compute d5a46e23bcbcda5 3598707bcbc is
manager code since I0883c2ba1989c5
not in stable/pike.
Change-Id: I35749374ff09b0 e98064c75ff9c33 dad577579c6 8bc41409d4fb574 ec472dc913)
Closes-Bug: #1721652
Related-Bug: #1709902
(cherry picked from commit 9252ffdacf26200