Return floating_ip['fixed_ip']['instance_uuid'] from neutronv2 API

The os-floating-ips extension translates the floating IP information
from the network API for the response but is only checking fields based
on what comes back from nova-network, which is using the FloatingIP
object. The neutronv2 API returns a different set of keys for the
instance/instance_uuid which the API extension doesn't handle and
therefore doesn't show the associated instance id for a given floating
IP.

The network APIs should return consistent data formats so this change
adds the expected key to fix the bug in the API extension (since the API
extensions shouldn't have to know the implementation details of the
network API, there are some extensions actually checking if it's the
neutron API and parsing the result set based on that).

This change will be used to backport the fix to the stable branches.

The longer term fix is to convert the neutronv2 get_floating_ip* API
methods to use nova objects which will be done as part of blueprint
kilo-objects in a separate change.

Closes-Bug: #1380965

Change-Id: I01df2096ced51eb9ebfd994cf8397f2fa094f6e3
This commit is contained in:
Matt Riedemann 2015-01-06 09:11:24 -08:00
parent 3e2e6968b0
commit 48c24dbb6b
2 changed files with 6 additions and 0 deletions

View File

@ -1152,6 +1152,9 @@ class API(base_api.NetworkAPI):
if fip['port_id']:
instance_uuid = port_dict[fip['port_id']]['device_id']
result['instance'] = {'uuid': instance_uuid}
# TODO(mriedem): remove this workaround once the get_floating_ip*
# API methods are converted to use nova objects.
result['fixed_ip']['instance_uuid'] = instance_uuid
else:
result['instance'] = None
return result

View File

@ -1869,6 +1869,9 @@ class TestNeutronv2(TestNeutronv2Base):
'instance': ({'uuid': self.port_data2[idx]['device_id']}
if fip_data['port_id']
else None)}
if expected['instance'] is not None:
expected['fixed_ip']['instance_uuid'] = \
expected['instance']['uuid']
return expected
def _test_get_floating_ip(self, fip_data, idx=0, by_address=False):