Clean up allocation if unshelve fails due to neutron
When port binding update fails during unshelve of a shelve offloaded
instance compute manager has to catch the exception and clean up the
destination host allocation.
Change-Id: I4c3fbb213e023ac16efc0b8561f975a659311684
Closes-Bug: #1862633
(cherry picked from commit e65d4a131a
)
This commit is contained in:
parent
bd1bfc13d7
commit
e6b749dbdd
|
@ -5654,10 +5654,11 @@ class ComputeManager(manager.Manager):
|
||||||
utils.get_image_from_system_metadata(
|
utils.get_image_from_system_metadata(
|
||||||
instance.system_metadata))
|
instance.system_metadata))
|
||||||
|
|
||||||
|
try:
|
||||||
self.network_api.setup_instance_network_on_host(context, instance,
|
self.network_api.setup_instance_network_on_host(context, instance,
|
||||||
self.host)
|
self.host)
|
||||||
network_info = self.network_api.get_instance_nw_info(context, instance)
|
network_info = self.network_api.get_instance_nw_info(
|
||||||
try:
|
context, instance)
|
||||||
with self.rt.instance_claim(context, instance, node, allocations,
|
with self.rt.instance_claim(context, instance, node, allocations,
|
||||||
limits):
|
limits):
|
||||||
self.driver.spawn(context, instance, image_meta,
|
self.driver.spawn(context, instance, image_meta,
|
||||||
|
|
|
@ -88,11 +88,6 @@ class UnshelveNeutronErrorTest(
|
||||||
'OS-EXT-STS:task_state': None})
|
'OS-EXT-STS:task_state': None})
|
||||||
|
|
||||||
# As the instance went back to offloaded state we expect no allocation
|
# 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 = self.placement_api.get(
|
||||||
'/allocations/%s' % server['id']).body['allocations']
|
'/allocations/%s' % server['id']).body['allocations']
|
||||||
self.assertEqual(1, len(allocations))
|
self.assertEqual(0, len(allocations))
|
||||||
|
|
Loading…
Reference in New Issue