DVR Floating IP create don't raise exception if agent not found

Patch [1] added handling of AgentNotFoundByTypeHost exception in
create_fip_agent_gw_port_if_not_exists method in
neutron.db.l3_dvr_db.DVRResourceOperationHandler class.
Unfortunatelly there was mistake there and such exception wasn't
catched properly.
That caused issue e.g. in functional-python35 tests but wasn't catched
properly in functional tests using python27.

This patch changes this to handle such exception properly.

[1] https://review.openstack.org/#/c/574917/

Change-Id: If43f2c944ff46d8b05fbcf68231fd04bed147ba0
This commit is contained in:
Slawek Kaplonski 2018-11-21 12:21:56 +01:00
parent cad8763189
commit 0745e32cd2
2 changed files with 4 additions and 9 deletions

View File

@ -983,8 +983,7 @@ class _DVRAgentInterfaceMixin(object):
try:
l3_agent_db = self._get_agent_by_type_and_host(
context, const.AGENT_TYPE_L3, host)
except agent_exc.AgentNotFoundByTypeHost(
agent_type=const.AGENT_TYPE_L3, host=host):
except agent_exc.AgentNotFoundByTypeHost:
LOG.warning("%(ag)s agent not found for the given host: %(host)s",
{'ag': const.AGENT_TYPE_L3,
'host': host})

View File

@ -20,7 +20,6 @@ from neutron_lib.api.definitions import portbindings
from neutron_lib.callbacks import events
from neutron_lib.callbacks import registry
from neutron_lib.callbacks import resources
from neutron_lib.exceptions import agent as agent_exc
from neutron_lib import constants
from neutron_lib import context
@ -338,12 +337,9 @@ class L3DvrTestCase(L3DvrTestCaseBase):
self.context, router['id'],
{'subnet_id': int_subnet['subnet']['id']})
if test_agent_mode is None:
self.assertRaises(
agent_exc.AgentNotFoundByTypeHost,
self.l3_plugin.create_fip_agent_gw_port_if_not_exists,
self.context,
ext_net_id,
'host1')
self.assertIsNone(
self.l3_plugin.create_fip_agent_gw_port_if_not_exists(
self.context, ext_net_id, 'host1'))
return
floating_ip = {'floating_network_id': ext_net_id,
'router_id': router['id'],