Introduce RpcCallback class

This class will be used to create proper self.target with appropriate
API version once we migrate to oslo.messaging.

blueprint oslo-messaging

Change-Id: I1fb5eb0aaac0d115fd84630e58b333e695ad4f5f
This commit is contained in:
Ihar Hrachyshka 2014-05-30 17:03:00 +02:00
parent 043f04c159
commit caf6044224
34 changed files with 116 additions and 40 deletions

View File

@ -26,6 +26,15 @@ class RpcProxy(proxy.RpcProxy):
'''
class RpcCallback(object):
'''
This class is created to facilitate migration from oslo-incubator
RPC layer implementation to oslo.messaging and is intended to set
callback version using oslo.messaging API once the migration is
applied.
'''
# exceptions
RPCException = rpc_common.RPCException
RemoteError = rpc_common.RemoteError

View File

@ -19,6 +19,7 @@ from oslo.config import cfg
import sqlalchemy as sa
from sqlalchemy.orm import exc
from neutron.common import rpc_compat
from neutron.db import model_base
from neutron.db import models_v2
from neutron.extensions import agent as ext_agent
@ -195,13 +196,14 @@ class AgentDbMixin(ext_agent.AgentPluginBase):
return self._create_or_update_agent(context, agent)
class AgentExtRpcCallback(object):
class AgentExtRpcCallback(rpc_compat.RpcCallback):
"""Processes the rpc report in plugin implementations."""
RPC_API_VERSION = '1.0'
START_TIME = timeutils.utcnow()
def __init__(self, plugin=None):
super(AgentExtRpcCallback, self).__init__()
self.plugin = plugin
def report_state(self, context, **kwargs):

View File

@ -17,6 +17,7 @@ import weakref
from oslo.config import cfg
from neutron.common import rpc_compat
from neutron.common import utils
from neutron.openstack.common import importutils
from neutron.openstack.common import log as logging
@ -29,7 +30,7 @@ from stevedore import driver
LOG = logging.getLogger(__name__)
class Manager(periodic_task.PeriodicTasks):
class Manager(rpc_compat.RpcCallback, periodic_task.PeriodicTasks):
# Set RPC API version to 1.0 by default.
RPC_API_VERSION = '1.0'

View File

@ -30,6 +30,7 @@ from neutron.agent.linux import utils
from neutron.agent import rpc as agent_rpc
from neutron.agent import securitygroups_rpc as sg_rpc
from neutron.common import config
from neutron.common import rpc_compat
from neutron.common import topics
from neutron import context as q_context
from neutron.extensions import securitygroup as ext_sg
@ -84,7 +85,8 @@ class SecurityGroupAgent(sg_rpc.SecurityGroupAgentRpcMixin):
self.init_firewall()
class RestProxyAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin):
class RestProxyAgent(rpc_compat.RpcCallback,
sg_rpc.SecurityGroupAgentRpcCallbackMixin):
RPC_API_VERSION = '1.1'

View File

@ -115,7 +115,8 @@ class AgentNotifierApi(rpc_compat.RpcProxy,
topic=self.topic_port_update)
class RestProxyCallbacks(sg_rpc_base.SecurityGroupServerRpcCallbackMixin,
class RestProxyCallbacks(rpc_compat.RpcCallback,
sg_rpc_base.SecurityGroupServerRpcCallbackMixin,
dhcp_rpc_base.DhcpRpcCallbackMixin):
RPC_API_VERSION = '1.1'

View File

@ -81,7 +81,8 @@ cfg.CONF.register_opts(SWITCH_OPTS, "SWITCH")
cfg.CONF.register_opts(PHYSICAL_INTERFACE_OPTS, "PHYSICAL_INTERFACE")
class BridgeRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin,
class BridgeRpcCallbacks(rpc_compat.RpcCallback,
dhcp_rpc_base.DhcpRpcCallbackMixin,
l3_rpc_base.L3RpcCallbackMixin,
sg_db_rpc.SecurityGroupServerRpcCallbackMixin):
"""Agent callback."""

View File

@ -29,6 +29,7 @@ from neutron.api.v2 import attributes
from neutron.common import constants
from neutron.common import exceptions as n_exc
from neutron.common import rpc as q_rpc
from neutron.common import rpc_compat
from neutron.common import topics
from neutron.common import utils
from neutron.db import agents_db
@ -60,7 +61,8 @@ from neutron.plugins.common import constants as svc_constants
LOG = logging.getLogger(__name__)
class N1kvRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin,
class N1kvRpcCallbacks(rpc_compat.RpcCallback,
dhcp_rpc_base.DhcpRpcCallbackMixin,
l3_rpc_base.L3RpcCallbackMixin):
"""Class to handle agent RPC calls."""

View File

@ -32,6 +32,7 @@ from neutron.agent import rpc as agent_rpc
from neutron.agent import securitygroups_rpc as sg_rpc
from neutron.common import config as logging_config
from neutron.common import constants as n_const
from neutron.common import rpc_compat
from neutron.common import topics
from neutron import context
from neutron.openstack.common import log as logging
@ -80,11 +81,13 @@ CONF.register_opts(agent_opts, "AGENT")
config.register_agent_state_opts_helper(cfg.CONF)
class HyperVSecurityAgent(sg_rpc.SecurityGroupAgentRpcMixin):
class HyperVSecurityAgent(rpc_compat.RpcCallback,
sg_rpc.SecurityGroupAgentRpcMixin):
# Set RPC API version to 1.1 by default.
RPC_API_VERSION = '1.1'
def __init__(self, context, plugin_rpc):
super(HyperVSecurityAgent, self).__init__()
self.context = context
self.plugin_rpc = plugin_rpc
@ -106,11 +109,13 @@ class HyperVSecurityAgent(sg_rpc.SecurityGroupAgentRpcMixin):
return dispatcher.RpcDispatcher([rpc_callback])
class HyperVSecurityCallbackMixin(sg_rpc.SecurityGroupAgentRpcCallbackMixin):
class HyperVSecurityCallbackMixin(rpc_compat.RpcCallback,
sg_rpc.SecurityGroupAgentRpcCallbackMixin):
# Set RPC API version to 1.1 by default.
RPC_API_VERSION = '1.1'
def __init__(self, sg_agent):
super(HyperVSecurityCallbackMixin, self).__init__()
self.sg_agent = sg_agent
@ -119,11 +124,12 @@ class HyperVPluginApi(agent_rpc.PluginApi,
pass
class HyperVNeutronAgent(object):
class HyperVNeutronAgent(rpc_compat.RpcCallback):
# Set RPC API version to 1.0 by default.
RPC_API_VERSION = '1.0'
def __init__(self):
super(HyperVNeutronAgent, self).__init__()
self._utils = utilsfactory.get_hypervutils()
self._polling_interval = CONF.AGENT.polling_interval
self._load_physical_network_mappings()

View File

@ -18,6 +18,7 @@
from neutron.common import constants as q_const
from neutron.common import rpc as q_rpc
from neutron.common import rpc_compat
from neutron.db import agents_db
from neutron.db import dhcp_rpc_base
from neutron.db import l3_rpc_base
@ -29,6 +30,7 @@ LOG = logging.getLogger(__name__)
class HyperVRpcCallbacks(
rpc_compat.RpcCallback,
dhcp_rpc_base.DhcpRpcCallbackMixin,
l3_rpc_base.L3RpcCallbackMixin):
@ -36,6 +38,7 @@ class HyperVRpcCallbacks(
RPC_API_VERSION = '1.1'
def __init__(self, notifier):
super(HyperVRpcCallbacks, self).__init__()
self.notifier = notifier
self._db = hyperv_db.HyperVPluginDB()

View File

@ -30,6 +30,7 @@ from neutron.agent.linux import ovs_lib
from neutron.agent import rpc as agent_rpc
from neutron.common import config as logging_config
from neutron.common import constants as n_const
from neutron.common import rpc_compat
from neutron.common import topics
from neutron.common import utils as n_utils
from neutron import context
@ -51,7 +52,7 @@ class SdnvePluginApi(agent_rpc.PluginApi):
topic=self.topic)
class SdnveNeutronAgent():
class SdnveNeutronAgent(rpc_compat.RpcCallback):
RPC_API_VERSION = '1.1'
@ -70,6 +71,7 @@ class SdnveNeutronAgent():
:param controller_ip: Ip address of SDN-VE controller.
'''
super(SdnveNeutronAgent, self).__init__()
self.root_helper = root_helper
self.int_bridge_name = integ_br
self.controller_ip = controller_ip

View File

@ -657,7 +657,8 @@ class LinuxBridgeManager:
self.remove_fdb_bridge_entry(mac, agent_ip, interface)
class LinuxBridgeRpcCallbacks(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
class LinuxBridgeRpcCallbacks(rpc_compat.RpcCallback,
sg_rpc.SecurityGroupAgentRpcCallbackMixin,
l2pop_rpc.L2populationRpcCallBackMixin):
# Set RPC API version to 1.0 by default.
@ -666,6 +667,7 @@ class LinuxBridgeRpcCallbacks(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
RPC_API_VERSION = '1.1'
def __init__(self, context, agent):
super(LinuxBridgeRpcCallbacks, self).__init__()
self.context = context
self.agent = agent
self.sg_agent = agent

View File

@ -55,7 +55,8 @@ from neutron.plugins.linuxbridge.db import l2network_db_v2 as db
LOG = logging.getLogger(__name__)
class LinuxBridgeRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin,
class LinuxBridgeRpcCallbacks(rpc_compat.RpcCallback,
dhcp_rpc_base.DhcpRpcCallbackMixin,
l3_rpc_base.L3RpcCallbackMixin,
sg_db_rpc.SecurityGroupServerRpcCallbackMixin
):

View File

@ -30,6 +30,7 @@ from neutron.api.v2 import attributes
from neutron.common import constants
from neutron.common import exceptions as n_exc
from neutron.common import rpc as n_rpc
from neutron.common import rpc_compat
from neutron.common import topics
from neutron.db import agents_db
from neutron.db import agentschedulers_db
@ -177,7 +178,8 @@ def _check_resource_exists(func, id, name, raise_exc=False):
raise MidonetPluginException(msg=exc)
class MidoRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin):
class MidoRpcCallbacks(rpc_compat.RpcCallback,
dhcp_rpc_base.DhcpRpcCallbackMixin):
RPC_API_VERSION = '1.1'
def create_rpc_dispatcher(self):

View File

@ -51,6 +51,8 @@ class RpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin,
# not having their own __init__ functions. If an __init__() is added
# to one, this could break. Fix this and add a unit test to cover this
# test in H3.
# FIXME(ihrachys): we can't use rpc_compat.RpcCallback here due
# to inheritance problems
super(RpcCallbacks, self).__init__(notifier, type_manager)
def create_rpc_dispatcher(self):

View File

@ -146,7 +146,8 @@ class EswitchManager(object):
self.network_map[network_id] = data
class MlnxEswitchRpcCallbacks(sg_rpc.SecurityGroupAgentRpcCallbackMixin):
class MlnxEswitchRpcCallbacks(rpc_compat.RpcCallback,
sg_rpc.SecurityGroupAgentRpcCallbackMixin):
# Set RPC API version to 1.0 by default.
# history
@ -154,6 +155,7 @@ class MlnxEswitchRpcCallbacks(sg_rpc.SecurityGroupAgentRpcCallbackMixin):
RPC_API_VERSION = '1.1'
def __init__(self, context, agent):
super(MlnxEswitchRpcCallbacks, self).__init__()
self.context = context
self.agent = agent
self.eswitch = agent.eswitch

View File

@ -18,6 +18,7 @@ from oslo.config import cfg
from neutron.common import constants as q_const
from neutron.common import rpc as q_rpc
from neutron.common import rpc_compat
from neutron.db import agents_db
from neutron.db import api as db_api
from neutron.db import dhcp_rpc_base
@ -29,7 +30,8 @@ from neutron.plugins.mlnx.db import mlnx_db_v2 as db
LOG = logging.getLogger(__name__)
class MlnxRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin,
class MlnxRpcCallbacks(rpc_compat.RpcCallback,
dhcp_rpc_base.DhcpRpcCallbackMixin,
l3_rpc_base.L3RpcCallbackMixin,
sg_db_rpc.SecurityGroupServerRpcCallbackMixin):
# History
@ -39,9 +41,6 @@ class MlnxRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin,
#to be compatible with Linux Bridge Agent on Network Node
TAP_PREFIX_LEN = 3
def __init__(self):
pass
def create_rpc_dispatcher(self):
"""Get the rpc dispatcher for this manager.

View File

@ -62,11 +62,12 @@ class NECPluginApi(agent_rpc.PluginApi):
port_removed=port_removed))
class NECAgentRpcCallback(object):
class NECAgentRpcCallback(rpc_compat.RpcCallback):
RPC_API_VERSION = '1.0'
def __init__(self, context, agent, sg_agent):
super(NECAgentRpcCallback, self).__init__()
self.context = context
self.agent = agent
self.sg_agent = sg_agent
@ -92,11 +93,13 @@ class SecurityGroupServerRpcApi(rpc_compat.RpcProxy,
class SecurityGroupAgentRpcCallback(
rpc_compat.RpcCallback,
sg_rpc.SecurityGroupAgentRpcCallbackMixin):
RPC_API_VERSION = sg_rpc.SG_RPC_VERSION
def __init__(self, context, sg_agent):
super(SecurityGroupAgentRpcCallback, self).__init__()
self.context = context
self.sg_agent = sg_agent

View File

@ -680,18 +680,20 @@ class NECPluginV2AgentNotifierApi(rpc_compat.RpcProxy,
topic=self.topic_port_update)
class DhcpRpcCallback(dhcp_rpc_base.DhcpRpcCallbackMixin):
class DhcpRpcCallback(rpc_compat.RpcCallback,
dhcp_rpc_base.DhcpRpcCallbackMixin):
# DhcpPluginApi BASE_RPC_API_VERSION
RPC_API_VERSION = '1.1'
class L3RpcCallback(l3_rpc_base.L3RpcCallbackMixin):
class L3RpcCallback(rpc_compat.RpcCallback, l3_rpc_base.L3RpcCallbackMixin):
# 1.0 L3PluginApi BASE_RPC_API_VERSION
# 1.1 Support update_floatingip_statuses
RPC_API_VERSION = '1.1'
class SecurityGroupServerRpcCallback(
rpc_compat.RpcCallback,
sg_db_rpc.SecurityGroupServerRpcCallbackMixin):
RPC_API_VERSION = sg_rpc.SG_RPC_VERSION
@ -707,11 +709,12 @@ class SecurityGroupServerRpcCallback(
return port
class NECPluginV2RPCCallbacks(object):
class NECPluginV2RPCCallbacks(rpc_compat.RpcCallback):
RPC_API_VERSION = '1.0'
def __init__(self, plugin):
super(NECPluginV2RPCCallbacks, self).__init__()
self.plugin = plugin
def create_rpc_dispatcher(self):

View File

@ -33,6 +33,7 @@ from neutron.agent.linux import utils
from neutron.agent import rpc as agent_rpc
from neutron.agent import securitygroups_rpc as sg_rpc
from neutron.common import constants as n_const
from neutron.common import rpc_compat
from neutron.common import topics
from neutron.common import utils as n_utils
from neutron import context
@ -159,7 +160,8 @@ class OFANeutronAgentRyuApp(app_manager.RyuApp):
agent.daemon_loop()
class OFANeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin):
class OFANeutronAgent(rpc_compat.RpcCallback,
sg_rpc.SecurityGroupAgentRpcCallbackMixin):
"""A agent for OpenFlow Agent ML2 mechanism driver.
OFANeutronAgent is a OpenFlow Agent agent for a ML2 plugin.
@ -199,6 +201,7 @@ class OFANeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin):
minimization, the number of seconds to wait before respawning
the ovsdb monitor.
"""
super(OFANeutronAgent, self).__init__()
self.ryuapp = ryuapp
self.veth_mtu = veth_mtu
self.root_helper = root_helper

View File

@ -37,11 +37,12 @@ from neutron.plugins.oneconvergence.lib import config
LOG = logging.getLogger(__name__)
class NVSDAgentRpcCallback(object):
class NVSDAgentRpcCallback(rpc_compat.RpcCallback):
RPC_API_VERSION = '1.0'
def __init__(self, context, agent, sg_agent):
super(NVSDAgentRpcCallback, self).__init__()
self.context = context
self.agent = agent
self.sg_agent = sg_agent
@ -66,11 +67,13 @@ class SecurityGroupServerRpcApi(rpc_compat.RpcProxy,
class SecurityGroupAgentRpcCallback(
rpc_compat.RpcCallback,
sg_rpc.SecurityGroupAgentRpcCallbackMixin):
RPC_API_VERSION = sg_rpc.SG_RPC_VERSION
def __init__(self, context, sg_agent):
super(SecurityGroupAgentRpcCallback, self).__init__()
self.context = context
self.sg_agent = sg_agent
@ -85,14 +88,14 @@ class SecurityGroupAgentRpc(sg_rpc.SecurityGroupAgentRpcMixin):
self.init_firewall()
class NVSDNeutronAgent(object):
class NVSDNeutronAgent(rpc_compat.RpcCallback):
# history
# 1.0 Initial version
# 1.1 Support Security Group RPC
RPC_API_VERSION = '1.1'
def __init__(self, integ_br, root_helper, polling_interval):
super(NVSDNeutronAgent, self).__init__()
self.int_br = ovs_lib.OVSBridge(integ_br, root_helper)
self.polling_interval = polling_interval
self.root_helper = root_helper

View File

@ -53,7 +53,8 @@ LOG = logging.getLogger(__name__)
IPv6 = 6
class NVSDPluginRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin,
class NVSDPluginRpcCallbacks(rpc_compat.RpcCallback,
dhcp_rpc_base.DhcpRpcCallbackMixin,
l3_rpc_base.L3RpcCallbackMixin,
sg_db_rpc.SecurityGroupServerRpcCallbackMixin):

View File

@ -35,6 +35,7 @@ from neutron.agent import rpc as agent_rpc
from neutron.agent import securitygroups_rpc as sg_rpc
from neutron.common import config as logging_config
from neutron.common import constants as q_const
from neutron.common import rpc_compat
from neutron.common import topics
from neutron.common import utils as q_utils
from neutron import context
@ -86,7 +87,8 @@ class OVSSecurityGroupAgent(sg_rpc.SecurityGroupAgentRpcMixin):
self.init_firewall(defer_refresh_firewall=True)
class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
class OVSNeutronAgent(rpc_compat.RpcCallback,
sg_rpc.SecurityGroupAgentRpcCallbackMixin,
l2population_rpc.L2populationRpcCallBackMixin):
'''Implements OVS-based tunneling, VLANs and flat networks.
@ -147,6 +149,7 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
:param arp_responder: Optional, enable local ARP responder if it is
supported.
'''
super(OVSNeutronAgent, self).__init__()
self.veth_mtu = veth_mtu
self.root_helper = root_helper
self.available_local_vlans = set(moves.xrange(q_const.MIN_VLAN_TAG,

View File

@ -59,7 +59,8 @@ from neutron.plugins.openvswitch import ovs_db_v2
LOG = logging.getLogger(__name__)
class OVSRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin,
class OVSRpcCallbacks(rpc_compat.RpcCallback,
dhcp_rpc_base.DhcpRpcCallbackMixin,
l3_rpc_base.L3RpcCallbackMixin,
sg_db_rpc.SecurityGroupServerRpcCallbackMixin):
@ -70,6 +71,7 @@ class OVSRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin,
RPC_API_VERSION = '1.1'
def __init__(self, notifier, tunnel_type):
super(OVSRpcCallbacks, self).__init__()
self.notifier = notifier
self.tunnel_type = tunnel_type

View File

@ -37,6 +37,7 @@ from neutron.agent import rpc as agent_rpc
from neutron.agent import securitygroups_rpc as sg_rpc
from neutron.common import config as logging_config
from neutron.common import exceptions as n_exc
from neutron.common import rpc_compat
from neutron.common import topics
from neutron import context as q_context
from neutron.extensions import securitygroup as ext_sg
@ -180,7 +181,8 @@ class RyuSecurityGroupAgent(sg_rpc.SecurityGroupAgentRpcMixin):
self.init_firewall()
class OVSNeutronOFPRyuAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin):
class OVSNeutronOFPRyuAgent(rpc_compat.RpcCallback,
sg_rpc.SecurityGroupAgentRpcCallbackMixin):
RPC_API_VERSION = '1.1'

View File

@ -48,13 +48,15 @@ from neutron.plugins.ryu.db import api_v2 as db_api_v2
LOG = logging.getLogger(__name__)
class RyuRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin,
class RyuRpcCallbacks(rpc_compat.RpcCallback,
dhcp_rpc_base.DhcpRpcCallbackMixin,
l3_rpc_base.L3RpcCallbackMixin,
sg_db_rpc.SecurityGroupServerRpcCallbackMixin):
RPC_API_VERSION = '1.1'
def __init__(self, ofp_rest_api_addr):
super(RyuRpcCallbacks, self).__init__()
self.ofp_rest_api_addr = ofp_rest_api_addr
def create_rpc_dispatcher(self):

View File

@ -25,6 +25,7 @@ from neutron.api.v2 import attributes
from neutron.common import constants as const
from neutron.common import exceptions as ntn_exc
from neutron.common import rpc as n_rpc
from neutron.common import rpc_compat
from neutron.db import agents_db
from neutron.db import db_base_plugin_v2
from neutron.db import dhcp_rpc_base
@ -43,7 +44,8 @@ METADATA_GATEWAY_IP = '169.254.169.253'
METADATA_DHCP_ROUTE = '169.254.169.254/32'
class NSXRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin):
class NSXRpcCallbacks(rpc_compat.RpcCallback,
dhcp_rpc_base.DhcpRpcCallbackMixin):
RPC_API_VERSION = '1.1'

View File

@ -35,10 +35,11 @@ from neutron.plugins.common import constants as const
LOG = logging.getLogger(__name__)
class FirewallCallbacks(object):
class FirewallCallbacks(rpc_compat.RpcCallback):
RPC_API_VERSION = '1.0'
def __init__(self, plugin):
super(FirewallCallbacks, self).__init__()
self.plugin = plugin
def create_rpc_dispatcher(self):

View File

@ -22,6 +22,7 @@ from oslo.config import cfg
from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api
from neutron.common import constants as q_const
from neutron.common import rpc as q_rpc
from neutron.common import rpc_compat
from neutron.common import topics
from neutron.db import api as qdbapi
from neutron.db import db_base_plugin_v2
@ -35,7 +36,8 @@ from neutron.openstack.common import rpc
from neutron.plugins.common import constants
class L3RouterPluginRpcCallbacks(l3_rpc_base.L3RpcCallbackMixin):
class L3RouterPluginRpcCallbacks(rpc_compat.RpcCallback,
l3_rpc_base.L3RpcCallbackMixin):
RPC_API_VERSION = '1.1'

View File

@ -21,6 +21,7 @@ from oslo.config import cfg
from neutron.agent import rpc as agent_rpc
from neutron.common import constants as n_const
from neutron.common import exceptions as n_exc
from neutron.common import rpc_compat
from neutron.common import topics
from neutron import context
from neutron.openstack.common import importutils
@ -46,7 +47,7 @@ class DeviceNotFoundOnAgent(n_exc.NotFound):
msg = _('Unknown device with pool_id %(pool_id)s')
class LbaasAgentManager(periodic_task.PeriodicTasks):
class LbaasAgentManager(rpc_compat.RpcCallback, periodic_task.PeriodicTasks):
RPC_API_VERSION = '2.0'
# history

View File

@ -53,7 +53,7 @@ class DriverNotSpecified(n_exc.NeutronException):
"in plugin driver.")
class LoadBalancerCallbacks(object):
class LoadBalancerCallbacks(rpc_compat.RpcCallback):
RPC_API_VERSION = '2.0'
# history
@ -63,6 +63,7 @@ class LoadBalancerCallbacks(object):
# - pool_deployed() and update_status() methods added;
def __init__(self, plugin):
super(LoadBalancerCallbacks, self).__init__()
self.plugin = plugin
def create_rpc_dispatcher(self):

View File

@ -189,6 +189,8 @@ class CiscoCsrIPsecDriver(device_drivers.DeviceDriver):
RPC_API_VERSION = '1.0'
def __init__(self, agent, host):
# TODO(ihrachys): we can't use RpcCallback here due to
# inheritance issues
self.host = host
self.conn = rpc.create_connection(new=True)
context = ctx.get_admin_context_without_session()

View File

@ -489,6 +489,8 @@ class IPsecDriver(device_drivers.DeviceDriver):
RPC_API_VERSION = '1.0'
def __init__(self, agent, host):
# TODO(ihrachys): we can't use RpcCallback here due to
# inheritance issues
self.agent = agent
self.conf = self.agent.conf
self.root_helper = self.agent.root_helper

View File

@ -17,6 +17,7 @@ from netaddr import core as net_exc
from neutron.common import exceptions
from neutron.common import rpc as n_rpc
from neutron.common import rpc_compat
from neutron.openstack.common import excutils
from neutron.openstack.common import log as logging
from neutron.openstack.common import rpc
@ -41,7 +42,7 @@ class CsrValidationFailure(exceptions.BadRequest):
"with value '%(value)s'")
class CiscoCsrIPsecVpnDriverCallBack(object):
class CiscoCsrIPsecVpnDriverCallBack(rpc_compat.RpcCallback):
"""Handler for agent to plugin RPC messaging."""
@ -51,6 +52,7 @@ class CiscoCsrIPsecVpnDriverCallBack(object):
RPC_API_VERSION = BASE_IPSEC_VERSION
def __init__(self, driver):
super(CiscoCsrIPsecVpnDriverCallBack, self).__init__()
self.driver = driver
def create_rpc_dispatcher(self):
@ -70,7 +72,8 @@ class CiscoCsrIPsecVpnDriverCallBack(object):
plugin.update_status_by_agent(context, status)
class CiscoCsrIPsecVpnAgentApi(service_drivers.BaseIPsecVpnAgentApi):
class CiscoCsrIPsecVpnAgentApi(service_drivers.BaseIPsecVpnAgentApi,
rpc_compat.RpcCallback):
"""API and handler for Cisco IPSec plugin to agent RPC messaging."""

View File

@ -17,6 +17,7 @@
import netaddr
from neutron.common import rpc as n_rpc
from neutron.common import rpc_compat
from neutron.openstack.common import log as logging
from neutron.openstack.common import rpc
from neutron.services.vpn.common import topics
@ -29,7 +30,7 @@ IPSEC = 'ipsec'
BASE_IPSEC_VERSION = '1.0'
class IPsecVpnDriverCallBack(object):
class IPsecVpnDriverCallBack(rpc_compat.RpcCallback):
"""Callback for IPSecVpnDriver rpc."""
# history
@ -38,6 +39,7 @@ class IPsecVpnDriverCallBack(object):
RPC_API_VERSION = BASE_IPSEC_VERSION
def __init__(self, driver):
super(IPsecVpnDriverCallBack, self).__init__()
self.driver = driver
def create_rpc_dispatcher(self):
@ -57,7 +59,8 @@ class IPsecVpnDriverCallBack(object):
plugin.update_status_by_agent(context, status)
class IPsecVpnAgentApi(service_drivers.BaseIPsecVpnAgentApi):
class IPsecVpnAgentApi(service_drivers.BaseIPsecVpnAgentApi,
rpc_compat.RpcCallback):
"""Agent RPC API for IPsecVPNAgent."""
RPC_API_VERSION = BASE_IPSEC_VERSION