From 1dfb72e0487c12553a50899d6aed292dea4dcd7f Mon Sep 17 00:00:00 2001 From: Balazs Gibizer Date: Mon, 16 Mar 2020 14:58:46 +0100 Subject: [PATCH] Fix intermittently failing regression case The test_unshelve_offloaded_fails_due_to_neutron could fail due to race condition. The test case only waits for the first instance.save() call at [1] but the allocation delete happens after it. This causes that the test case can still see the allocation of the offloaded server in placement. The fix makes sure that the test waits for the second instance.save() by checking for the host of the instance. [1] https://github.com/openstack/nova/blob/stable/rocky/nova/compute/manager.py#L5274-L5288 Related-Bug #1862633 Change-Id: Ic1c3d35749fbdc7f5b6f6ec1e16b8fcf37c10de8 --- nova/tests/functional/regressions/test_bug_1862633.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nova/tests/functional/regressions/test_bug_1862633.py b/nova/tests/functional/regressions/test_bug_1862633.py index 5d3826a391..8c101bb2b5 100644 --- a/nova/tests/functional/regressions/test_bug_1862633.py +++ b/nova/tests/functional/regressions/test_bug_1862633.py @@ -54,7 +54,8 @@ class UnshelveNeutronErrorTest( } self.api.post_server_action(server['id'], req) self._wait_for_server_parameter( - server, {'status': 'SHELVED_OFFLOADED'}) + server, {'status': 'SHELVED_OFFLOADED', + 'OS-EXT-SRV-ATTR:host': None}) allocations = self.placement_api.get( '/allocations/%s' % server['id']).body['allocations'] self.assertEqual(0, len(allocations)) @@ -79,7 +80,8 @@ class UnshelveNeutronErrorTest( self._wait_for_server_parameter( server, {'status': 'SHELVED_OFFLOADED', - 'OS-EXT-STS:task_state': None}) + 'OS-EXT-STS:task_state': None, + 'OS-EXT-SRV-ATTR:host': None}) # As the instance went back to offloaded state we expect no allocation allocations = self.placement_api.get(