Merge "Show the correct ptr record instead of the first one"

This commit is contained in:
Zuul 2017-11-22 17:29:30 +00:00 committed by Gerrit Code Review
commit cd14803438
2 changed files with 18 additions and 2 deletions

View File

@ -1982,10 +1982,12 @@ class Service(service.RPCService, service.Service):
tenant_fips = self._list_floatingips(context, region=region)
self._get_floatingip(context, region, floatingip_id, tenant_fips)
fip = self._get_floatingip(context, region, floatingip_id, tenant_fips)
result = self._list_to_dict([fip], keys=['region', 'id'])
valid, invalid = self._determine_floatingips(
elevated_context, tenant_fips)
elevated_context, result)
self._invalidate_floatingips(context, invalid)

View File

@ -2325,6 +2325,20 @@ class CentralServiceTest(CentralTestCase):
self.assertEqual(fip['address'], fip_ptr['address'])
self.assertIsNone(fip_ptr['ptrdname'])
def test_get_floatingip_dual_no_record(self):
context = self.get_context(tenant='a')
self.network_api.fake.allocate_floatingip(context.tenant)
fip = self.network_api.fake.allocate_floatingip(context.tenant)
fip_ptr = self.central_service.get_floatingip(
context, fip['region'], fip['id'])
self.assertEqual(fip['region'], fip_ptr['region'])
self.assertEqual(fip['id'], fip_ptr['id'])
self.assertEqual(fip['address'], fip_ptr['address'])
self.assertIsNone(fip_ptr['ptrdname'])
def test_get_floatingip_with_record(self):
context = self.get_context(tenant='a')