From 03c4dc3573f640d06b80d686a389f1f3438a6d25 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Thu, 7 Aug 2014 00:19:41 +0800 Subject: [PATCH] Remove duplicated check for router connect to external net In the function get_assoc_data, we check the router which get from _get_router_for_floatingip whether connect to external net, but as it has already checked in _get_router_for_floatingip. Change-Id: I0c00c480273145538d19569dc0a679e9935ad8f9 Closes-bug: #1353414 --- neutron/db/l3_db.py | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/neutron/db/l3_db.py b/neutron/db/l3_db.py index 203c998be..27f900075 100644 --- a/neutron/db/l3_db.py +++ b/neutron/db/l3_db.py @@ -679,8 +679,8 @@ class L3_NAT_db_mixin(l3.RouterPluginBase): When a floating IP is associated with an internal port, we need to extract/determine some data associated with the internal port, including the internal_ip_address, and router_id. - We also need to confirm that this internal port is owned by the - tenant who owns the floating IP. + The confirmation of the internal port whether owned by the tenant who + owns the floating IP will be confirmed by _get_router_for_floatingip. """ (internal_port, internal_subnet_id, internal_ip_address) = self._internal_fip_assoc_data(context, fip) @@ -688,18 +688,6 @@ class L3_NAT_db_mixin(l3.RouterPluginBase): internal_port, internal_subnet_id, floating_network_id) - # confirm that this router has a floating - # ip enabled gateway with support for this floating IP network - try: - port_qry = context.elevated().session.query(models_v2.Port) - port_qry.filter_by( - network_id=floating_network_id, - device_id=router_id, - device_owner=DEVICE_OWNER_ROUTER_GW).one() - except exc.NoResultFound: - raise l3.ExternalGatewayForFloatingIPNotFound( - subnet_id=internal_subnet_id, - port_id=internal_port['id']) return (fip['port_id'], internal_ip_address, router_id) -- 2.45.2