nova/nova/tests/unit/conductor
Erik Olof Gunnar Andersson e3b68a1c8b Cleanup when hitting MaxRetriesExceeded from no host_available
Prior to this patch there was a condition when no
host_available was true and an exception would get
raised without first cleaning up the instance.
This causes instances to get indefinitely stuck in
a scheduling state.

This patch fixes this by calling the clean up function
and then exits build_instances using a return statement.

The related functional regression recreate test is updated
to show this fixes the bug.

NOTE(mriedem): There are three changes in this backport. First,
since bug 1819460 and change I78fc2312274471a7bd85a263de12cc5a0b19fd10
do not apply to Rocky, _cleanup_when_reschedule_fails is added here.
Second, the test_bug_1837955 setUp needed to stub notifications
since change I017d1a31139c9300642dd706eadc265f7c954ca8 is not
in Rocky to do that in ProviderUsageBaseTestCase. Third, the unit
test is changed to mock _set_vm_state_and_notify since
change Ibfb0a6db5920d921c4fc7cabf3f4d2838ea7f421 is not in Rocky
for compute utils to call notify_about_compute_task_error.

Change-Id: I6a2c63a4c33e783100208fd3f45eb52aad49e3d6
Closes-bug: #1837955
(cherry picked from commit b98d4ba6d5)
(cherry picked from commit fcc2b9e33e)
2019-07-30 12:16:15 -04:00
..
tasks Update instance.availability_zone during live migration 2019-03-13 18:14:19 -04:00
__init__.py move all tests to nova/tests/unit 2014-11-12 15:31:08 -05:00
test_conductor.py Cleanup when hitting MaxRetriesExceeded from no host_available 2019-07-30 12:16:15 -04:00