fix unstable shelve offload functional tests
The functional tests that are shelved offloaded instances and
asserted that the resource allocation of the instance are
freed were unstable. These tests only waited for the instance
state to become SHELVED_OFFLOADED before checked the allocations.
However the compute manager sets the instance state to
SHELVED_OFFLOADED before deleting the allocations[1]. Therefore these
tests were racy.
With this patch the test will wait not only for the instance status to
change but also for the instance host to be nulled as that happens
after the resources are freed.
[1] e4f89ed5dd/nova/compute/manager.py (L4502-L4521)
Change-Id: Ibb90571907cafcb649284e4ea30810a307f1737e
Closes-Bug: #1721514
This commit is contained in:
@@ -1963,7 +1963,9 @@ class ServerMovingTests(ProviderUsageBaseTestCase):
|
|||||||
'shelveOffload': {}
|
'shelveOffload': {}
|
||||||
}
|
}
|
||||||
self.api.post_server_action(server['id'], req)
|
self.api.post_server_action(server['id'], req)
|
||||||
self._wait_for_state_change(self.api, server, 'SHELVED_OFFLOADED')
|
self._wait_for_server_parameter(
|
||||||
|
self.api, server, {'status': 'SHELVED_OFFLOADED',
|
||||||
|
'OS-EXT-SRV-ATTR:host': None})
|
||||||
source_usages = self._get_provider_usages(source_rp_uuid)
|
source_usages = self._get_provider_usages(source_rp_uuid)
|
||||||
self.assertEqual({'VCPU': 0,
|
self.assertEqual({'VCPU': 0,
|
||||||
'MEMORY_MB': 0,
|
'MEMORY_MB': 0,
|
||||||
@@ -2656,7 +2658,9 @@ class ServerUnshelveSpawnFailTests(ProviderUsageBaseTestCase):
|
|||||||
# shelve offload the server
|
# shelve offload the server
|
||||||
self.flags(shelved_offload_time=0)
|
self.flags(shelved_offload_time=0)
|
||||||
self.api.post_server_action(server['id'], {'shelve': None})
|
self.api.post_server_action(server['id'], {'shelve': None})
|
||||||
self._wait_for_state_change(self.api, server, 'SHELVED_OFFLOADED')
|
self._wait_for_server_parameter(
|
||||||
|
self.api, server, {'status': 'SHELVED_OFFLOADED',
|
||||||
|
'OS-EXT-SRV-ATTR:host': None})
|
||||||
|
|
||||||
# assert allocations were removed from the host
|
# assert allocations were removed from the host
|
||||||
usages = self._get_provider_usages(rp_uuid)
|
usages = self._get_provider_usages(rp_uuid)
|
||||||
|
|||||||
Reference in New Issue
Block a user