From: Russell Bryant Date: Thu, 13 Nov 2014 21:31:10 +0000 (+0000) Subject: Drop several uses of RpcCallback X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=f7f2aa931fdc0bcff5c3e5a78b3d75d2698d8e28;p=openstack-build%2Fneutron-build.git 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 --- diff --git a/neutron/api/rpc/handlers/dvr_rpc.py b/neutron/api/rpc/handlers/dvr_rpc.py index e9028cf64..7e26cdc5c 100644 --- a/neutron/api/rpc/handlers/dvr_rpc.py +++ b/neutron/api/rpc/handlers/dvr_rpc.py @@ -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): diff --git a/neutron/api/rpc/handlers/l3_rpc.py b/neutron/api/rpc/handlers/l3_rpc.py index d4b2b95c2..f61f12bd4 100644 --- a/neutron/api/rpc/handlers/l3_rpc.py +++ b/neutron/api/rpc/handlers/l3_rpc.py @@ -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): diff --git a/neutron/api/rpc/handlers/metadata_rpc.py b/neutron/api/rpc/handlers/metadata_rpc.py index 4c42ca2a2..acd59610c 100644 --- a/neutron/api/rpc/handlers/metadata_rpc.py +++ b/neutron/api/rpc/handlers/metadata_rpc.py @@ -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): diff --git a/neutron/api/rpc/handlers/securitygroups_rpc.py b/neutron/api/rpc/handlers/securitygroups_rpc.py index e4a16b2f5..31016fa75 100644 --- a/neutron/api/rpc/handlers/securitygroups_rpc.py +++ b/neutron/api/rpc/handlers/securitygroups_rpc.py @@ -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): diff --git a/neutron/db/agents_db.py b/neutron/db/agents_db.py index 1d7b0bca3..5893ef1e7 100644 --- a/neutron/db/agents_db.py +++ b/neutron/db/agents_db.py @@ -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): diff --git a/neutron/plugins/brocade/NeutronPlugin.py b/neutron/plugins/brocade/NeutronPlugin.py index 2672ce757..a1ba20ba5 100644 --- a/neutron/plugins/brocade/NeutronPlugin.py +++ b/neutron/plugins/brocade/NeutronPlugin.py @@ -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 diff --git a/neutron/plugins/hyperv/agent/hyperv_neutron_agent.py b/neutron/plugins/hyperv/agent/hyperv_neutron_agent.py index 856a986ab..8131d358c 100644 --- a/neutron/plugins/hyperv/agent/hyperv_neutron_agent.py +++ b/neutron/plugins/hyperv/agent/hyperv_neutron_agent.py @@ -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__() diff --git a/neutron/plugins/hyperv/rpc_callbacks.py b/neutron/plugins/hyperv/rpc_callbacks.py index ab4bbcdec..bd4aa5eb8 100644 --- a/neutron/plugins/hyperv/rpc_callbacks.py +++ b/neutron/plugins/hyperv/rpc_callbacks.py @@ -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__() diff --git a/neutron/plugins/ibm/agent/sdnve_neutron_agent.py b/neutron/plugins/ibm/agent/sdnve_neutron_agent.py index a30f91170..f501392ce 100644 --- a/neutron/plugins/ibm/agent/sdnve_neutron_agent.py +++ b/neutron/plugins/ibm/agent/sdnve_neutron_agent.py @@ -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, diff --git a/neutron/services/firewall/fwaas_plugin.py b/neutron/services/firewall/fwaas_plugin.py index 49feefea1..15179f4df 100644 --- a/neutron/services/firewall/fwaas_plugin.py +++ b/neutron/services/firewall/fwaas_plugin.py @@ -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__() diff --git a/neutron/services/vpn/service_drivers/ipsec.py b/neutron/services/vpn/service_drivers/ipsec.py index 9fe480666..8618c08c4 100644 --- a/neutron/services/vpn/service_drivers/ipsec.py +++ b/neutron/services/vpn/service_drivers/ipsec.py @@ -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__()