From dcb94c962ffd7961a6fb9979712ed468175a855e Mon Sep 17 00:00:00 2001
From: Yong Sheng Gong <gongysh@unitedstack.com>
Date: Mon, 15 Jul 2013 14:04:21 +0800
Subject: [PATCH] Use the correct tunnel_type to notify agents

Bug #1201274

Change-Id: I9de55d168ba03cb6a5273b4c2ce140cd190e38ee
---
 neutron/plugins/openvswitch/ovs_neutron_plugin.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/neutron/plugins/openvswitch/ovs_neutron_plugin.py b/neutron/plugins/openvswitch/ovs_neutron_plugin.py
index 55880df9f9b..8a50b2ff9ab 100644
--- a/neutron/plugins/openvswitch/ovs_neutron_plugin.py
+++ b/neutron/plugins/openvswitch/ovs_neutron_plugin.py
@@ -69,8 +69,9 @@ class OVSRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin,
 
     RPC_API_VERSION = '1.1'
 
-    def __init__(self, notifier):
+    def __init__(self, notifier, tunnel_type):
         self.notifier = notifier
+        self.tunnel_type = tunnel_type
 
     def create_rpc_dispatcher(self):
         '''Get the rpc dispatcher for this manager.
@@ -161,7 +162,7 @@ class OVSRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin,
         entry['tunnels'] = tunnels
         # Notify all other listening agents
         self.notifier.tunnel_update(rpc_context, tunnel.ip_address,
-                                    tunnel.id, cfg.CONF.OVS.tunnel_type)
+                                    tunnel.id, self.tunnel_type)
         # Return the list of tunnels IP's to the agent
         return entry
 
@@ -281,6 +282,7 @@ class OVSNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
                       self.tenant_network_type)
             sys.exit(1)
         self.enable_tunneling = cfg.CONF.OVS.enable_tunneling
+        self.tunnel_type = None
         if self.enable_tunneling:
             self.tunnel_type = cfg.CONF.OVS.tunnel_type or constants.TYPE_GRE
         elif cfg.CONF.OVS.tunnel_type:
@@ -309,7 +311,7 @@ class OVSNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
         self.notifier = AgentNotifierApi(topics.AGENT)
         self.dhcp_agent_notifier = dhcp_rpc_agent_api.DhcpAgentNotifyAPI()
         self.l3_agent_notifier = l3_rpc_agent_api.L3AgentNotify
-        self.callbacks = OVSRpcCallbacks(self.notifier)
+        self.callbacks = OVSRpcCallbacks(self.notifier, self.tunnel_type)
         self.dispatcher = self.callbacks.create_rpc_dispatcher()
         self.conn.create_consumer(self.topic, self.dispatcher,
                                   fanout=False)