From 56f4272a8992f251cb9dda42e5bcad287d182678 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Fri, 7 Nov 2014 00:21:10 +0100 Subject: [PATCH] Remove neutron.common.rpc.RPCException Remove RPCException, which was just mapped directly to oslo.messaging.MessagingException for the purposes of minimizing the impact to the code base when moving from openstack.common.rpc to oslo.messaging. Part of blueprint drop-rpc-compat. Change-Id: Idc5af503f24217fbd2d982c338434c200d025521 --- neutron/agent/l3_agent.py | 2 +- neutron/agent/metadata/agent.py | 3 ++- neutron/common/rpc.py | 1 - .../cisco/cfg_agent/service_helpers/routing_svc_helper.py | 4 +++- neutron/tests/unit/cisco/cfg_agent/test_routing_svc_helper.py | 4 ++-- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/neutron/agent/l3_agent.py b/neutron/agent/l3_agent.py index b6bb65a02..20f5f9029 100644 --- a/neutron/agent/l3_agent.py +++ b/neutron/agent/l3_agent.py @@ -1896,7 +1896,7 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback, self._queue.add(update) self.fullsync = False LOG.debug(_("_sync_routers_task successfully completed")) - except n_rpc.RPCException: + except messaging.MessagingException: LOG.exception(_("Failed synchronizing routers due to RPC error")) self.fullsync = True except Exception: diff --git a/neutron/agent/metadata/agent.py b/neutron/agent/metadata/agent.py index bc99cbf47..b64d1f6b5 100644 --- a/neutron/agent/metadata/agent.py +++ b/neutron/agent/metadata/agent.py @@ -24,6 +24,7 @@ eventlet.monkey_patch() import httplib2 from neutronclient.v2_0 import client from oslo.config import cfg +from oslo import messaging import six.moves.urllib.parse as urlparse import webob @@ -167,7 +168,7 @@ class MetadataProxyHandler(object): if self.use_rpc: try: return self.plugin_rpc.get_ports(self.context, filters) - except (n_rpc.RPCException, AttributeError): + except (messaging.MessagingException, AttributeError): # TODO(obondarev): remove fallback once RPC is proven # to work fine with metadata agent (K or L release at most) LOG.warning(_LW('Server does not support metadata RPC, ' diff --git a/neutron/common/rpc.py b/neutron/common/rpc.py index 9da79fd52..eaa06f695 100644 --- a/neutron/common/rpc.py +++ b/neutron/common/rpc.py @@ -275,6 +275,5 @@ def create_connection(new=True): # exceptions -RPCException = messaging.MessagingException RemoteError = messaging.RemoteError MessagingTimeout = messaging.MessagingTimeout diff --git a/neutron/plugins/cisco/cfg_agent/service_helpers/routing_svc_helper.py b/neutron/plugins/cisco/cfg_agent/service_helpers/routing_svc_helper.py index 6f6b59265..d19a1b17c 100644 --- a/neutron/plugins/cisco/cfg_agent/service_helpers/routing_svc_helper.py +++ b/neutron/plugins/cisco/cfg_agent/service_helpers/routing_svc_helper.py @@ -16,6 +16,8 @@ import collections import eventlet import netaddr +from oslo import messaging + from neutron.common import constants as l3_constants from neutron.common import rpc as n_rpc from neutron.common import topics @@ -284,7 +286,7 @@ class RoutingServiceHelper(): if device_ids: return self.plugin_rpc.get_routers(self.context, hd_ids=device_ids) - except n_rpc.RPCException: + except messaging.MessagingException: LOG.exception(_("RPC Error in fetching routers from plugin")) self.fullsync = True diff --git a/neutron/tests/unit/cisco/cfg_agent/test_routing_svc_helper.py b/neutron/tests/unit/cisco/cfg_agent/test_routing_svc_helper.py index dff1d5cd7..44cb69f75 100644 --- a/neutron/tests/unit/cisco/cfg_agent/test_routing_svc_helper.py +++ b/neutron/tests/unit/cisco/cfg_agent/test_routing_svc_helper.py @@ -15,10 +15,10 @@ import copy import mock from oslo.config import cfg +from oslo import messaging from neutron.common import config as base_config from neutron.common import constants as l3_constants -from neutron.common import rpc as n_rpc from neutron.openstack.common import log as logging from neutron.openstack.common import uuidutils from neutron.plugins.cisco.cfg_agent import cfg_agent @@ -583,7 +583,7 @@ class TestBasicRoutingOperations(base.BaseTestCase): @mock.patch("eventlet.GreenPool.spawn_n") def test_process_services_with_rpc_error(self, mock_spawn): router, port = prepare_router_data() - self.plugin_api.get_routers.side_effect = n_rpc.RPCException + self.plugin_api.get_routers.side_effect = messaging.MessagingException self.routing_helper.fullsync = False self.routing_helper.updated_routers.add(router['id']) self.routing_helper.process_service() -- 2.45.2