Drop several uses of RpcCallback

This patch drops several uses of the RpcCallback compatibility class.
All of these were trivial and straight forward conversions so I
batched them up.

There are still several other uses of RpcCallback, but the conversions
are were not necessarily trivial, and may be broken in one way or
another, so I wanted to address them separately.  In particular, the
use of mixin classes means that there could be cases where the version
declaration is being stepped on, so they need to be investigated more
closely.

Part of blueprint drop-rpc-compat.

Change-Id: I0977aee863d4fcc6a14a025215c6e41fe38a87f0
This commit is contained in:
Russell Bryant 2014-11-13 21:31:10 +00:00
parent c52840e516
commit f7f2aa931f
11 changed files with 39 additions and 30 deletions

View File

@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo import messaging
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
@ -57,13 +58,13 @@ class DVRServerRpcApiMixin(object):
version=self.DVR_RPC_VERSION)
class DVRServerRpcCallback(n_rpc.RpcCallback):
class DVRServerRpcCallback(object):
"""Plugin-side RPC (implementation) for agent-to-plugin interaction."""
# History
# 1.0 Initial version
RPC_API_VERSION = "1.0"
target = messaging.Target(version='1.0')
@property
def plugin(self):

View File

@ -14,11 +14,11 @@
# limitations under the License.
from oslo.config import cfg
from oslo import messaging
from oslo.serialization import jsonutils
from neutron.common import constants
from neutron.common import exceptions
from neutron.common import rpc as n_rpc
from neutron.common import utils
from neutron import context as neutron_context
from neutron.extensions import l3
@ -31,7 +31,7 @@ from neutron.plugins.common import constants as plugin_constants
LOG = logging.getLogger(__name__)
class L3RpcCallback(n_rpc.RpcCallback):
class L3RpcCallback(object):
"""L3 agent RPC callback in plugin implementations."""
# 1.0 L3PluginApi BASE_RPC_API_VERSION
@ -39,7 +39,7 @@ class L3RpcCallback(n_rpc.RpcCallback):
# 1.2 Added methods for DVR support
# 1.3 Added a method that returns the list of activated services
# 1.4 Added L3 HA update_router_state
RPC_API_VERSION = '1.4'
target = messaging.Target(version='1.4')
@property
def plugin(self):

View File

@ -13,15 +13,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from neutron.common import rpc as n_rpc
from oslo import messaging
from neutron import manager
class MetadataRpcCallback(n_rpc.RpcCallback):
class MetadataRpcCallback(object):
"""Metadata agent RPC callback in plugin implementations."""
# 1.0 MetadataPluginAPI BASE_RPC_API_VERSION
RPC_API_VERSION = '1.0'
target = messaging.Target(version='1.0')
@property
def plugin(self):

View File

@ -12,7 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron.common import rpc as n_rpc
from oslo import messaging
from neutron import manager
@ -20,16 +21,16 @@ from neutron import manager
# from neutron/agent/securitygroups_rpc.py.
class SecurityGroupServerRpcCallback(n_rpc.RpcCallback):
class SecurityGroupServerRpcCallback(object):
"""Callback for SecurityGroup agent RPC in plugin implementations."""
# API version history:
# 1.1 - Initial version
# 1.2 - security_group_info_for_devices introduced as an optimization
# NOTE: RPC_API_VERSION must not be overridden in subclasses
# NOTE: target must not be overridden in subclasses
# to keep RPC API version consistent across plugins.
RPC_API_VERSION = '1.2'
target = messaging.Target(version='1.2')
@property
def plugin(self):

View File

@ -17,12 +17,12 @@ from eventlet import greenthread
from oslo.config import cfg
from oslo.db import exception as db_exc
from oslo import messaging
from oslo.serialization import jsonutils
import sqlalchemy as sa
from sqlalchemy.orm import exc
from sqlalchemy import sql
from neutron.common import rpc as n_rpc
from neutron.db import model_base
from neutron.db import models_v2
from neutron.extensions import agent as ext_agent
@ -215,10 +215,10 @@ class AgentDbMixin(ext_agent.AgentPluginBase):
return self._create_or_update_agent(context, agent)
class AgentExtRpcCallback(n_rpc.RpcCallback):
class AgentExtRpcCallback(object):
"""Processes the rpc report in plugin implementations."""
RPC_API_VERSION = '1.0'
target = messaging.Target(version='1.0')
START_TIME = timeutils.utcnow()
def __init__(self, plugin=None):

View File

@ -20,6 +20,7 @@
"""Implentation of Brocade Neutron Plugin."""
from oslo.config import cfg
from oslo import messaging
from neutron.agent import securitygroups_rpc as sg_rpc
from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
@ -75,10 +76,10 @@ cfg.CONF.register_opts(SWITCH_OPTS, "SWITCH")
cfg.CONF.register_opts(PHYSICAL_INTERFACE_OPTS, "PHYSICAL_INTERFACE")
class BridgeRpcCallbacks(n_rpc.RpcCallback):
class BridgeRpcCallbacks(object):
"""Agent callback."""
RPC_API_VERSION = '1.2'
target = messaging.Target(version='1.2')
# Device names start with "tap"
# history
# 1.1 Support Security Group RPC

View File

@ -23,6 +23,7 @@ import eventlet
eventlet.monkey_patch()
from oslo.config import cfg
from oslo import messaging
from neutron.agent.common import config
from neutron.agent import rpc as agent_rpc
@ -116,9 +117,9 @@ class HyperVPluginApi(agent_rpc.PluginApi,
pass
class HyperVNeutronAgent(n_rpc.RpcCallback):
class HyperVNeutronAgent(object):
# Set RPC API version to 1.1 by default.
RPC_API_VERSION = '1.1'
target = messaging.Target(version='1.1')
def __init__(self):
super(HyperVNeutronAgent, self).__init__()

View File

@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo import messaging
from neutron.common import constants as q_const
from neutron.common import rpc as n_rpc
from neutron.openstack.common import log as logging
from neutron.plugins.hyperv import db as hyperv_db
@ -22,12 +23,12 @@ from neutron.plugins.hyperv import db as hyperv_db
LOG = logging.getLogger(__name__)
class HyperVRpcCallbacks(n_rpc.RpcCallback):
class HyperVRpcCallbacks(object):
# history
# 1.1 Support Security Group RPC
# 1.2 Support get_devices_details_list
RPC_API_VERSION = '1.2'
target = messaging.Target(version='1.2')
def __init__(self, notifier):
super(HyperVRpcCallbacks, self).__init__()

View File

@ -23,13 +23,13 @@ import eventlet
eventlet.monkey_patch()
from oslo.config import cfg
from oslo import messaging
from neutron.agent.linux import ip_lib
from neutron.agent.linux import ovs_lib
from neutron.agent import rpc as agent_rpc
from neutron.common import config as common_config
from neutron.common import constants as n_const
from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.common import utils as n_utils
from neutron import context
@ -50,9 +50,9 @@ class SdnvePluginApi(agent_rpc.PluginApi):
self.make_msg('sdnve_info', info=info))
class SdnveNeutronAgent(n_rpc.RpcCallback):
class SdnveNeutronAgent(object):
RPC_API_VERSION = '1.1'
target = messaging.Target(version='1.1')
def __init__(self, integ_br, interface_mappings,
info, root_helper, polling_interval,

View File

@ -14,6 +14,7 @@
# under the License.
from oslo.config import cfg
from oslo import messaging
from neutron.common import exceptions as n_exception
from neutron.common import rpc as n_rpc
@ -28,8 +29,8 @@ from neutron.plugins.common import constants as const
LOG = logging.getLogger(__name__)
class FirewallCallbacks(n_rpc.RpcCallback):
RPC_API_VERSION = '1.0'
class FirewallCallbacks(object):
target = messaging.Target(version='1.0')
def __init__(self, plugin):
super(FirewallCallbacks, self).__init__()

View File

@ -14,6 +14,8 @@
# under the License.
import netaddr
from oslo import messaging
from neutron.common import rpc as n_rpc
from neutron.openstack.common import log as logging
from neutron.services.vpn.common import topics
@ -26,13 +28,13 @@ IPSEC = 'ipsec'
BASE_IPSEC_VERSION = '1.0'
class IPsecVpnDriverCallBack(n_rpc.RpcCallback):
class IPsecVpnDriverCallBack(object):
"""Callback for IPSecVpnDriver rpc."""
# history
# 1.0 Initial version
RPC_API_VERSION = BASE_IPSEC_VERSION
target = messaging.Target(version=BASE_IPSEC_VERSION)
def __init__(self, driver):
super(IPsecVpnDriverCallBack, self).__init__()