Fixes Rpc related exception in NVP plugin

The rpc changes from commit 05383d13 were not also made against
the nvp_plugin. Bug #1084803

Change-Id: Iac95065bda2f6b83e07c27045f374ab8690865ca
This commit is contained in:
Aaron Rosen 2012-11-29 16:24:55 -08:00
parent d0a284de2f
commit ac81d9d345

View File

@ -41,15 +41,14 @@ from nvp_plugin_version import PLUGIN_VERSION
from quantum.api.v2 import attributes
from quantum.common import constants
from quantum.common import exceptions as exception
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 import dhcp_rpc_base
from quantum.db import models_v2
from quantum.openstack.common import cfg
from quantum.openstack.common import context
from quantum.openstack.common import rpc
from quantum.openstack.common.rpc import dispatcher
CONFIG_FILE = "nvp.ini"
@ -62,7 +61,7 @@ LOG = logging.getLogger("QuantumPlugin")
def parse_config():
"""Parse the supplied plugin configuration.
`
:param config: a ConfigParser() object encapsulating nvp.ini.
:returns: A tuple: (clusters, plugin_config). 'clusters' is a list of
NVPCluster objects, 'plugin_config' is a dictionary with plugin
@ -104,16 +103,13 @@ class NVPRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin):
# Set RPC API version to 1.0 by default.
RPC_API_VERSION = '1.0'
def __init__(self, rpc_context):
self.rpc_context = rpc_context
def create_rpc_dispatcher(self):
'''Get the rpc dispatcher for this manager.
If a manager would like to set an rpc API version, or support more than
one class as the target of rpc messages, override this method.
'''
return dispatcher.RpcDispatcher([self])
return q_rpc.PluginRpcDispatcher([self])
class NVPCluster(object):
@ -295,11 +291,8 @@ class NvpPluginV2(db_base_plugin_v2.QuantumDbPluginV2):
def setup_rpc(self):
# RPC support for dhcp
self.topic = topics.PLUGIN
self.rpc_context = context.RequestContext('quantum', 'quantum',
is_admin=False)
self.conn = rpc.create_connection(new=True)
self.callbacks = NVPRpcCallbacks(self.rpc_context)
self.dispatcher = self.callbacks.create_rpc_dispatcher()
self.dispatcher = NVPRpcCallbacks().create_rpc_dispatcher()
self.conn.create_consumer(self.topic, self.dispatcher,
fanout=False)
# Consume from all consumers in a thread