RPC has a version of itself. In Neutron a plugin implements
several RPC interface, so a single RPC version doesn't work.
In Mixin callback class approach, RPC versioning depends on
each plugin implementation and it makes harder to maintain
RPC version appropriately. This patch series replaces mixin
RPC callback of server side with a separate class.
This commit handles server-side callback of DVR ML2 RPC interface.
Partial-Bug: #
1359416
Change-Id: I1b6383f7b0af5d9aed18eda3a15f21d3504d0347
# under the License.
from neutron.common import log
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron import manager
from neutron.openstack.common import log as logging
version=self.DVR_RPC_VERSION)
-class DVRServerRpcCallbackMixin(object):
+class DVRServerRpcCallback(n_rpc.RpcCallback):
"""Plugin-side RPC (implementation) for agent-to-plugin interaction."""
+ # History
+ # 1.0 Initial version
+
+ RPC_API_VERSION = "1.0"
+
@property
def plugin(self):
if not getattr(self, '_plugin', None):
def get_dvr_mac_address_list(self, context):
return self.plugin.get_dvr_mac_address_list(context)
- def get_dvr_mac_address_by_host(self, context, host):
+ def get_dvr_mac_address_by_host(self, context, **kwargs):
+ host = kwargs.get('host')
+ LOG.debug("DVR Agent requests mac_address for host %s", host)
return self.plugin.get_dvr_mac_address_by_host(context, host)
- def get_ports_on_host_by_subnet(self, context, host, subnet):
+ def get_ports_on_host_by_subnet(self, context, **kwargs):
+ host = kwargs.get('host')
+ subnet = kwargs.get('subnet')
+ LOG.debug("DVR Agent requests list of VM ports on host %s", host)
return self.plugin.get_ports_on_host_by_subnet(context,
host, subnet)
- def get_subnet_for_dvr(self, context, subnet):
+ def get_subnet_for_dvr(self, context, **kwargs):
+ subnet = kwargs.get('subnet')
return self.plugin.get_subnet_for_dvr(context, subnet)
from neutron.agent import securitygroups_rpc as sg_rpc
from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
from neutron.api.rpc.handlers import dhcp_rpc
+from neutron.api.rpc.handlers import dvr_rpc
from neutron.api.v2 import attributes
from neutron.common import constants as const
from neutron.common import exceptions as exc
def start_rpc_listeners(self):
self.endpoints = [rpc.RpcCallbacks(self.notifier, self.type_manager),
+ dvr_rpc.DVRServerRpcCallback(),
dhcp_rpc.DhcpRpcCallback(),
agents_db.AgentExtRpcCallback()]
self.topic = topics.PLUGIN
class RpcCallbacks(n_rpc.RpcCallback,
- dvr_rpc.DVRServerRpcCallbackMixin,
sg_db_rpc.SecurityGroupServerRpcCallbackMixin,
type_tunnel.TunnelRpcCallbackMixin):
except exceptions.PortNotFound:
LOG.debug('Port %s not found during ARP update', port_id)
- def get_dvr_mac_address_by_host(self, rpc_context, **kwargs):
- host = kwargs.get('host')
- LOG.debug("DVR Agent requests mac_address for host %s", host)
- return super(RpcCallbacks, self).get_dvr_mac_address_by_host(
- rpc_context, host)
-
- def get_ports_on_host_by_subnet(self, rpc_context, **kwargs):
- host = kwargs.get('host')
- subnet = kwargs.get('subnet')
- LOG.debug("DVR Agent requests list of VM ports on host %s", host)
- return super(RpcCallbacks, self).get_ports_on_host_by_subnet(
- rpc_context, host, subnet)
-
- def get_subnet_for_dvr(self, rpc_context, **kwargs):
- subnet = kwargs.get('subnet')
- return super(RpcCallbacks, self).get_subnet_for_dvr(rpc_context,
- subnet)
-
class AgentNotifierApi(n_rpc.RpcProxy,
dvr_rpc.DVRAgentRpcApiMixin,