]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Host route to metadata server with Bigswitch/Floodlight Plugin
authorSumit Naiksatam <sumitnaiksatam@gmail.com>
Fri, 1 Mar 2013 06:00:32 +0000 (22:00 -0800)
committerSumit Naiksatam <sumitnaiksatam@gmail.com>
Fri, 1 Mar 2013 23:34:37 +0000 (15:34 -0800)
Host route to metadata server was not getting propagated
to VM when using the Big Switch/Floodlight plugin. The
reason being the update to the subnet (with the host
route information) was not being picked up by the dhcp
agent. This is being fixed here by sending a notification
to the dhcp agent when the host route is added to the subnet.

Fixes: Bug #1134043
Change-Id: If040f51946bcb734da319249df17d03e68aa5588

quantum/plugins/bigswitch/plugin.py

index 0a01d4ae812e6b3fdf675efae9e4a4870fc0db7c..6dce904aeeabaded33c7badec22a5f5a47bc552d 100644 (file)
@@ -52,6 +52,7 @@ import socket
 
 from oslo.config import cfg
 
+from quantum.api.rpc.agentnotifiers import dhcp_rpc_agent_api
 from quantum.common import constants as const
 from quantum.common import exceptions
 from quantum.common import rpc as q_rpc
@@ -328,6 +329,7 @@ class QuantumRestProxyV2(db_base_plugin_v2.QuantumDbPluginV2,
         if sync_data:
             self._send_all_data()
 
+        self._dhcp_agent_notifier = dhcp_rpc_agent_api.DhcpAgentNotifyAPI()
         LOG.debug(_("QuantumRestProxyV2: initialization done"))
 
     def create_network(self, context, network):
@@ -1113,10 +1115,15 @@ class QuantumRestProxyV2(db_base_plugin_v2.QuantumDbPluginV2,
             nexthop = fixed_ip['ip_address']
             subnet['host_routes'] = [{'destination': destination,
                                       'nexthop': nexthop}]
-            self.update_subnet(context, subnet_id, {'subnet': subnet})
-            LOG.debug(_("Adding host route: "))
-            LOG.debug(_("destination:%s nexthop:%s"), (destination,
-                                                       nexthop))
+            updated_subnet = self.update_subnet(context,
+                                                subnet_id,
+                                                {'subnet': subnet})
+            payload = {'subnet': updated_subnet}
+            self._dhcp_agent_notifier.notify(context, payload,
+                                             'subnet.update.end')
+            LOG.debug("Adding host route: ")
+            LOG.debug("destination:%s nexthop:%s" % (destination,
+                                                     nexthop))
 
     def _get_network_with_floatingips(self, network):
         admin_context = qcontext.get_admin_context()