Merge "Clean up allocation if unshelve fails due to neutron" into stable/rocky
This commit is contained in:
commit
08207cb2ae
|
@ -5413,10 +5413,11 @@ class ComputeManager(manager.Manager):
|
|||
utils.get_image_from_system_metadata(
|
||||
instance.system_metadata))
|
||||
|
||||
self.network_api.setup_instance_network_on_host(context, instance,
|
||||
self.host)
|
||||
network_info = self.network_api.get_instance_nw_info(context, instance)
|
||||
try:
|
||||
self.network_api.setup_instance_network_on_host(context, instance,
|
||||
self.host)
|
||||
network_info = self.network_api.get_instance_nw_info(
|
||||
context, instance)
|
||||
with rt.instance_claim(context, instance, node, limits):
|
||||
self.driver.spawn(context, instance, image_meta,
|
||||
injected_files=[],
|
||||
|
|
|
@ -58,7 +58,8 @@ class UnshelveNeutronErrorTest(
|
|||
}
|
||||
self.api.post_server_action(server['id'], req)
|
||||
self._wait_for_server_parameter(
|
||||
self.api, server, {'status': 'SHELVED_OFFLOADED'})
|
||||
self.api, 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))
|
||||
|
@ -84,14 +85,10 @@ class UnshelveNeutronErrorTest(
|
|||
self.api,
|
||||
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(
|
||||
# '/allocations/%s' % server['id']).body['allocations']
|
||||
# self.assertEqual(0, len(allocations))
|
||||
#
|
||||
# but the allocation is leaked this is bug 1862633
|
||||
allocations = self.placement_api.get(
|
||||
'/allocations/%s' % server['id']).body['allocations']
|
||||
self.assertEqual(1, len(allocations))
|
||||
self.assertEqual(0, len(allocations))
|
||||
|
|
Loading…
Reference in New Issue