Created
March 28, 2018 22:07
-
-
Save harlowja/e3cb3a84ff06834d48a973bba4313174 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From ply Mon Sep 17 00:00:00 2001 | |
From: dbingham <[email protected]> | |
Date: Fri, 17 Jun 2016 09:25:23 -0700 | |
Subject: GD: Allow multiple floating IPs to single port. | |
diff --git a/neutron/db/l3_db.py b/neutron/db/l3_db.py | |
index ef4c486..607c310 100644 | |
--- a/neutron/db/l3_db.py | |
+++ b/neutron/db/l3_db.py | |
@@ -914,20 +914,6 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase): | |
context, | |
fip, | |
floatingip_db['floating_network_id']) | |
- fip_qry = context.session.query(FloatingIP) | |
- try: | |
- fip_qry.filter_by( | |
- fixed_port_id=fip['port_id'], | |
- floating_network_id=floatingip_db['floating_network_id'], | |
- fixed_ip_address=internal_ip_address).one() | |
- raise l3.FloatingIPPortAlreadyAssociated( | |
- port_id=fip['port_id'], | |
- fip_id=floatingip_db['id'], | |
- floating_ip_address=floatingip_db['floating_ip_address'], | |
- fixed_ip=internal_ip_address, | |
- net_id=floatingip_db['floating_network_id']) | |
- except exc.NoResultFound: | |
- pass | |
return port_id, internal_ip_address, router_id | |
def _update_fip_assoc(self, context, fip, floatingip_db, external_port): | |
diff --git a/neutron/tests/unit/extensions/test_l3.py b/neutron/tests/unit/extensions/test_l3.py | |
index e9e3397..8b60458 100644 | |
--- a/neutron/tests/unit/extensions/test_l3.py | |
+++ b/neutron/tests/unit/extensions/test_l3.py | |
@@ -2089,13 +2089,15 @@ class L3NatTestCaseBase(L3NatTestCaseMixin): | |
self.assertIsNone(body['floatingip']['fixed_ip_address']) | |
self.assertIsNone(body['floatingip']['router_id']) | |
- def test_two_fips_one_port_invalid_return_409(self): | |
+ def test_two_fips_one_port(self): | |
with self.floatingip_with_assoc() as fip1: | |
- res = self._create_floatingip( | |
+ fip2 = self._make_floatingip( | |
self.fmt, | |
fip1['floatingip']['floating_network_id'], | |
- fip1['floatingip']['port_id']) | |
- self.assertEqual(res.status_int, exc.HTTPConflict.code) | |
+ port_id=fip1['floatingip']['port_id']) | |
+ self.assertIsNotNone(fip2) | |
+ self._delete('floatingips', | |
+ fip2['floatingip']['id']) | |
def test_floating_ip_direct_port_delete_returns_409(self): | |
found = False | |
-- | |
1.8.3 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment