pluins/ryu: Fixes context exception in Ryu plugin

Bug 1089220
This is the Ryu counter part of
https://review.openstack.org/#/c/15726
Change-ID of I913b48dcd84d275cd7de30ca990be00c243e63ea,
changeset of 05383d1340aecd7192609a9197c249886d844a46

Ryu plugin also needs to be taught the update.

Change-Id: I52fbf36df6e0769a032a7602637cabd93796fe1c
This commit is contained in:
Isaku Yamahata 2012-12-12 12:02:53 +09:00
parent 8e7fe17caf
commit a8c0c00069

View File

@ -21,16 +21,16 @@ from ryu.app import rest_nw_id
from quantum.common import constants as q_const
from quantum.common import exceptions as q_exc
from quantum.common import rpc as q_rpc
from quantum.common import topics
from quantum.db import api as db
from quantum.db import db_base_plugin_v2
from quantum.db.dhcp_rpc_base import DhcpRpcCallbackMixin
from quantum.db import dhcp_rpc_base
from quantum.db import l3_db
from quantum.db import models_v2
from quantum.openstack.common import cfg
from quantum.openstack.common import log as logging
from quantum.openstack.common import rpc
from quantum.openstack.common.rpc import dispatcher
from quantum.plugins.ryu.common import config
from quantum.plugins.ryu.db import api_v2 as db_api_v2
from quantum.plugins.ryu import ofp_service_type
@ -39,6 +39,14 @@ from quantum.plugins.ryu import ofp_service_type
LOG = logging.getLogger(__name__)
class RyuRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin):
RPC_API_VERSION = '1.0'
def create_rpc_dispatcher(self):
return q_rpc.PluginRpcDispatcher([self])
class RyuQuantumPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
l3_db.L3_NAT_db_mixin):
@ -76,8 +84,8 @@ class RyuQuantumPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
def _setup_rpc(self):
self.conn = rpc.create_connection(new=True)
self.callback = DhcpRpcCallbackMixin()
self.dispatcher = dispatcher.RpcDispatcher([self.callback])
self.callbacks = RyuRpcCallbacks()
self.dispatcher = self.callbacks.create_rpc_dispatcher()
self.conn.create_consumer(topics.PLUGIN, self.dispatcher, fanout=False)
self.conn.consume_in_thread()