Scope dhcp rpc api using a messaging namespace
This patch updates the rpc API used by the DHCP agent to make calls back into the neutron plugin to use the 'dhcp' namespace instead of the default namespace. The reason is that this API is exposed over the 'q-plugin' topic along with several other interfaces. Without the use of namespaces, all of the interfaces are effectively treated as one by oslo.messaging. When a namespace is used, the interface can be versioned independently and when a method is called, the only class considered for fulfilling the request is the one that claims to implement the 'dhcp' namespace. While we're here, add documentation to both the client and server side of this interface that indicates where the other side is located. Part of blueprint rpc-docs-and-namespaces. Change-Id: I9e56aa34fc560ae3fc749c51788436e32179d0a1
This commit is contained in:
parent
69f01aab16
commit
4a69b69e58
|
@ -404,6 +404,11 @@ class DhcpAgent(manager.Manager):
|
|||
class DhcpPluginApi(object):
|
||||
"""Agent side of the dhcp rpc API.
|
||||
|
||||
This class implements the client side of an rpc interface. The server side
|
||||
of this interface can be found in
|
||||
neutron.api.rpc.handlers.dhcp_rpc.DhcpRpcCallback. For more information
|
||||
about changing rpc interfaces, see doc/source/devref/rpc_api.rst.
|
||||
|
||||
API version history:
|
||||
1.0 - Initial version.
|
||||
1.1 - Added get_active_networks_info, create_dhcp_port,
|
||||
|
@ -415,7 +420,10 @@ class DhcpPluginApi(object):
|
|||
self.context = context
|
||||
self.host = cfg.CONF.host
|
||||
self.use_namespaces = use_namespaces
|
||||
target = messaging.Target(topic=topic, version='1.0')
|
||||
target = messaging.Target(
|
||||
topic=topic,
|
||||
namespace=constants.RPC_NAMESPACE_DHCP_PLUGIN,
|
||||
version='1.0')
|
||||
self.client = n_rpc.get_client(target)
|
||||
|
||||
def get_active_networks_info(self):
|
||||
|
|
|
@ -32,13 +32,20 @@ LOG = logging.getLogger(__name__)
|
|||
|
||||
|
||||
class DhcpRpcCallback(object):
|
||||
"""DHCP agent RPC callback in plugin implementations."""
|
||||
"""DHCP agent RPC callback in plugin implementations.
|
||||
|
||||
This class implements the server side of an rpc interface. The client
|
||||
side of this interface can be found in
|
||||
neutron.agent.dhcp_agent.DhcpPluginApi. For more information about
|
||||
changing rpc interfaces, see doc/source/devref/rpc_api.rst.
|
||||
"""
|
||||
|
||||
# API version history:
|
||||
# 1.0 - Initial version.
|
||||
# 1.1 - Added get_active_networks_info, create_dhcp_port,
|
||||
# and update_dhcp_port methods.
|
||||
target = messaging.Target(version='1.1')
|
||||
target = messaging.Target(namespace=constants.RPC_NAMESPACE_DHCP_PLUGIN,
|
||||
version='1.1')
|
||||
|
||||
def _get_active_networks(self, context, **kwargs):
|
||||
"""Retrieve and return a list of the active networks."""
|
||||
|
|
|
@ -137,3 +137,6 @@ ATTRIBUTES_TO_UPDATE = 'attributes_to_update'
|
|||
# In SQLite integer can be stored in 1, 2, 3, 4, 6, or 8 bytes,
|
||||
# but here it will be limited by this value for consistency.
|
||||
DB_INTEGER_MAX_VALUE = 2 ** 31 - 1
|
||||
|
||||
# RPC Interface for agents to call DHCP API implemented on the plugin side
|
||||
RPC_NAMESPACE_DHCP_PLUGIN = 'dhcp'
|
||||
|
|
Loading…
Reference in New Issue