Wait for 404 on floatingip delete

Currently the FloatingIP resource assumes that delete is an atomic
operation, but there have been reports of downstream dependency
deletes failing because the floatingip still exists.

This change triggers the standard neutron resource
check_delete_complete 404 polling to ensure the floatingip really is
gone.

Change-Id: I9be34ef8b64a79d3211841cb7a7acd945f1f107c
Closes-Bug: #1595270
This commit is contained in:
Steve Baker 2016-06-23 10:37:22 +12:00
parent 0864664209
commit a3860b1162
2 changed files with 24 additions and 2 deletions

View File

@ -243,6 +243,7 @@ class FloatingIP(neutron.NeutronResource):
def handle_delete(self):
with self.client_plugin().ignore_not_found:
self.client().delete_floatingip(self.resource_id)
return True
def handle_update(self, json_snippet, tmpl_diff, prop_diff):
if prop_diff:

View File

@ -194,13 +194,28 @@ class NeutronFloatingIPTest(common.HeatTestCase):
).AndRaise(qe.NeutronClientException(status_code=404))
neutronclient.Client.show_floatingip(
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
).MultipleTimes().AndReturn({'floatingip': {
).AndReturn({'floatingip': {
'id': 'fc68ea2c-b60b-4b4f-bd82-94ec81110766',
'floating_network_id': u'abcd1234'
}})
neutronclient.Client.show_floatingip(
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
).AndReturn({'floatingip': {
'id': 'fc68ea2c-b60b-4b4f-bd82-94ec81110766',
'floating_network_id': u'abcd1234'
}})
neutronclient.Client.delete_floatingip(
'fc68ea2c-b60b-4b4f-bd82-94ec81110766').AndReturn(None)
neutronclient.Client.show_floatingip(
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
).AndReturn({'floatingip': {
'id': 'fc68ea2c-b60b-4b4f-bd82-94ec81110766',
'floating_network_id': u'abcd1234'
}})
neutronclient.Client.show_floatingip(
'fc68ea2c-b60b-4b4f-bd82-94ec81110766').AndRaise(
qe.NeutronClientException(status_code=404))
neutronclient.Client.delete_floatingip(
'fc68ea2c-b60b-4b4f-bd82-94ec81110766').AndRaise(
qe.NeutronClientException(status_code=404))
@ -388,6 +403,9 @@ class NeutronFloatingIPTest(common.HeatTestCase):
neutronclient.Client.delete_floatingip(
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
).AndReturn(None)
neutronclient.Client.show_floatingip(
'fc68ea2c-b60b-4b4f-bd82-94ec81110766').AndRaise(
qe.NeutronClientException(status_code=404))
neutronclient.Client.delete_port(
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
@ -527,7 +545,7 @@ class NeutronFloatingIPTest(common.HeatTestCase):
}})
neutronclient.Client.show_floatingip(
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
).MultipleTimes().AndReturn({'floatingip': {
).AndReturn({'floatingip': {
'status': 'ACTIVE',
'id': 'fc68ea2c-b60b-4b4f-bd82-94ec81110766',
'floating_ip_address': '172.24.4.98'
@ -626,6 +644,9 @@ class NeutronFloatingIPTest(common.HeatTestCase):
neutronclient.Client.delete_floatingip(
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
).AndReturn(None)
neutronclient.Client.show_floatingip(
'fc68ea2c-b60b-4b4f-bd82-94ec81110766').AndRaise(
qe.NeutronClientException(status_code=404))
neutronclient.Client.delete_port(
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'