]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Drop several uses of RpcCallback
authorRussell Bryant <rbryant@redhat.com>
Thu, 13 Nov 2014 21:31:10 +0000 (21:31 +0000)
committerRussell Bryant <rbryant@redhat.com>
Wed, 19 Nov 2014 17:18:34 +0000 (17:18 +0000)
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

neutron/api/rpc/handlers/dvr_rpc.py
neutron/api/rpc/handlers/l3_rpc.py
neutron/api/rpc/handlers/metadata_rpc.py
neutron/api/rpc/handlers/securitygroups_rpc.py
neutron/db/agents_db.py
neutron/plugins/brocade/NeutronPlugin.py
neutron/plugins/hyperv/agent/hyperv_neutron_agent.py
neutron/plugins/hyperv/rpc_callbacks.py
neutron/plugins/ibm/agent/sdnve_neutron_agent.py
neutron/services/firewall/fwaas_plugin.py
neutron/services/vpn/service_drivers/ipsec.py

index e9028cf6475d67cc94522b5adc409c5cd412d7f4..7e26cdc5c746af57342852dd33931126d7d214cc 100644 (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):
index d4b2b95c2ada1991f34d9d156de1dc79380131c5..f61f12bd45dcf3774cf0181aa7afafe19b4581dc 100644 (file)
 # 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):
index 4c42ca2a29eb7cd6b5304372f8399b2f845436a6..acd59610caa8a7c233c830469a211727c33dd43e 100644 (file)
 # 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):
index e4a16b2f58d6566daf57cd7e507c761c76d2d786..31016fa753cb41d2315a1d06c1e08b8c48b31932 100644 (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):
index 1d7b0bca396416b328d914030b8299503884d029..5893ef1e7ff8953fdc4a22e5fabaf15c15ac34df 100644 (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):
index 2672ce757ddf6aaeec8e5dfc5ba2579529b62564..a1ba20ba53ede8f5731ed9eab2284db0e5657d33 100644 (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
index 856a986ab312bc0dc9066c0b1c31080a843b4e32..8131d358c65240e694b9ae03b5d1d9d70582294b 100644 (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__()
index ab4bbcdecfd80b0b4d22f9946956b5afeda7d4d8..bd4aa5eb829a423f12c9546925b81415a4483120 100644 (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__()
index a30f91170e0bb4b7f955561ad8de54151b12dd83..f501392ce50854b47bc6951967de229b899a8224 100644 (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,
index 49feefea10e710fb50453b5d649bec86e31103af..15179f4df2295b994d6e728c80c65a26d38ebbce 100644 (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__()
index 9fe48066662855cc783b5ad9e65276dd1f148588..8618c08c4cb96916809b1f3b857d39958e9cbbda 100644 (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__()