Properly delete OS::Nova::FloatingIPAssociation

Currently when deleting a Nova FloatingIPAssociation, Heat sends
Nova the floating IP's Id, but Nova expects the actual IP address for
the removal. This leads to invalid database queries on Nova's side, so
this change makes sure that novaclient gets the IP address instead of the Id.

Change-Id: I15dbaf19d9467f5c65dddde77d4115b59e036b0f
Closes-bug: #1299827
This commit is contained in:
Paul Van Eck 2014-03-30 11:07:29 -07:00
parent 3aaa843d1f
commit b69e228792
2 changed files with 11 additions and 4 deletions

View File

@ -110,9 +110,9 @@ class NovaFloatingIpAssociation(resource.Resource):
try:
server = self.nova().servers.get(self.properties[self.SERVER])
if server:
self.nova().servers.remove_floating_ip(
server, self.properties[self.FLOATING_IP]
)
fl_ip = self.nova().floating_ips.\
get(self.properties[self.FLOATING_IP])
self.nova().servers.remove_floating_ip(server, fl_ip.ip)
except clients.novaclient.exceptions.NotFound:
pass

View File

@ -156,7 +156,14 @@ class NovaFloatingIPTest(HeatTestCase):
self.novaclient.servers.get(
'67dc62f9-efde-4c8b-94af-013e00f5dc57').AndReturn('server')
self.novaclient.servers.remove_floating_ip('server', '1')
self.novaclient.floating_ips.get('1').AndReturn(
self._make_obj(**{
'id': '1',
'ip': '11.0.0.1',
'pool': 'public'
})
)
self.novaclient.servers.remove_floating_ip('server', '11.0.0.1')
self.m.ReplayAll()