Fixes Context exception in BigSwitch/FloodLight Plugin

Bug #1083389

Aligning with the changes in the patch: https://review.openstack.org/#/c/15726
to only use Quantum API context.

Change-Id: I5644ad59c34430a9d558c39bbc07f594609ebfbc
This commit is contained in:
Sumit Naiksatam 2012-11-29 02:17:59 -08:00
parent d2ba190173
commit 52da6ef633

View File

@ -50,6 +50,7 @@ import json
import socket import socket
from quantum.common import exceptions from quantum.common import exceptions
from quantum.common import rpc as q_rpc
from quantum.common import topics from quantum.common import topics
from quantum import context as qcontext from quantum import context as qcontext
from quantum.db import api as db from quantum.db import api as db
@ -57,10 +58,8 @@ from quantum.db import db_base_plugin_v2
from quantum.db import dhcp_rpc_base from quantum.db import dhcp_rpc_base
from quantum.db import models_v2 from quantum.db import models_v2
from quantum.openstack.common import cfg from quantum.openstack.common import cfg
from quantum.openstack.common import context as glbcontext
from quantum.openstack.common import log as logging from quantum.openstack.common import log as logging
from quantum.openstack.common import rpc from quantum.openstack.common import rpc
from quantum.openstack.common.rpc import dispatcher
from quantum.plugins.bigswitch.version import version_string_with_vcs from quantum.plugins.bigswitch.version import version_string_with_vcs
@ -238,11 +237,8 @@ class RpcProxy(dhcp_rpc_base.DhcpRpcCallbackMixin):
RPC_API_VERSION = '1.0' RPC_API_VERSION = '1.0'
def __init__(self, rpc_context):
self.rpc_context = rpc_context
def create_rpc_dispatcher(self): def create_rpc_dispatcher(self):
return dispatcher.RpcDispatcher([self]) return q_rpc.PluginRpcDispatcher([self])
class QuantumRestProxyV2(db_base_plugin_v2.QuantumDbPluginV2): class QuantumRestProxyV2(db_base_plugin_v2.QuantumDbPluginV2):
@ -279,10 +275,8 @@ class QuantumRestProxyV2(db_base_plugin_v2.QuantumDbPluginV2):
# init dhcp support # init dhcp support
self.topic = topics.PLUGIN self.topic = topics.PLUGIN
self.rpc_context = glbcontext.RequestContext(
'quantum', 'quantum', is_admin=False)
self.conn = rpc.create_connection(new=True) self.conn = rpc.create_connection(new=True)
self.callbacks = RpcProxy(self.rpc_context) self.callbacks = RpcProxy()
self.dispatcher = self.callbacks.create_rpc_dispatcher() self.dispatcher = self.callbacks.create_rpc_dispatcher()
self.conn.create_consumer(self.topic, self.dispatcher, self.conn.create_consumer(self.topic, self.dispatcher,
fanout=False) fanout=False)