From: Kevin Benton Date: Wed, 9 Oct 2013 06:02:20 +0000 (-0700) Subject: BigSwitch: correct net to backend on floating IP disassociation X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=d6ab23ee696e449d8bf3301ab8ee131d57fd9622;p=openstack-build%2Fneutron-build.git BigSwitch: correct net to backend on floating IP disassociation The corrects the network that is updated on the backendw when a floating IP is disassociated. It was incorrectly sending the tenant's network when the update is to the external network the floating address belongs to. Closes-Bug: #1237209 Change-Id: I55211ba3b0062e167843830bb318eb8e46249160 (cherry picked from commit 39b8bddb1124d16eae15f667f8d921e8ddf5701d) --- diff --git a/neutron/plugins/bigswitch/plugin.py b/neutron/plugins/bigswitch/plugin.py index a7cf72ec2..fe793b6e0 100644 --- a/neutron/plugins/bigswitch/plugin.py +++ b/neutron/plugins/bigswitch/plugin.py @@ -1075,11 +1075,19 @@ class NeutronRestProxyV2(db_base_plugin_v2.NeutronDbPluginV2, LOG.debug(_("NeutronRestProxyV2: diassociate_floatingips() called")) super(NeutronRestProxyV2, self).disassociate_floatingips(context, port_id) - port = super(NeutronRestProxyV2, self).get_port(context, port_id) - net_id = port['network_id'] - orig_net = super(NeutronRestProxyV2, self).get_network(context, - net_id) - self._send_update_network(orig_net, context) + try: + ext_net_id = self.get_external_network_id(context) + if ext_net_id: + # Use the elevated state of the context for the ext_net query + admin_context = context.elevated() + ext_net = super(NeutronRestProxyV2, + self).get_network(admin_context, ext_net_id) + # update external network on network controller + self._send_update_network(ext_net, admin_context) + except exceptions.TooManyExternalNetworks: + # get_external_network can raise errors when multiple external + # networks are detected, which isn't supported by the Plugin + LOG.error(_("NeutronRestProxyV2: too many external networks")) def _send_all_data(self): """Pushes all data to network ctrl (networks/ports, ports/attachments).