Catch InvalidInput in DHCP port actions

The exception handler checking for concurrently deleted subnets
was missing InvalidInput, which comes from IPAM when a port creation
request references a subnet that doesn't exist.

This patch just catches that exception.

Change-Id: I14f9e4bddde845e3fef2b0d8649d3954ba5c93bd
Closes-Bug: #1618187
This commit is contained in:
Kevin Benton 2016-08-27 03:25:27 -07:00
parent 79927038bc
commit c05751a556
2 changed files with 4 additions and 0 deletions

View File

@ -104,6 +104,7 @@ class DhcpRpcCallback(object):
except (db_exc.DBError, except (db_exc.DBError,
exceptions.NetworkNotFound, exceptions.NetworkNotFound,
exceptions.SubnetNotFound, exceptions.SubnetNotFound,
exceptions.InvalidInput,
exceptions.IpAddressGenerationFailure) as e: exceptions.IpAddressGenerationFailure) as e:
with excutils.save_and_reraise_exception(reraise=False) as ctxt: with excutils.save_and_reraise_exception(reraise=False) as ctxt:
if isinstance(e, exceptions.IpAddressGenerationFailure): if isinstance(e, exceptions.IpAddressGenerationFailure):

View File

@ -157,6 +157,9 @@ class TestDhcpRpcCallback(base.BaseTestCase):
self._test__port_action_with_failures( self._test__port_action_with_failures(
exc=n_exc.IpAddressGenerationFailure(net_id='foo_network_id'), exc=n_exc.IpAddressGenerationFailure(net_id='foo_network_id'),
action='create_port') action='create_port')
self._test__port_action_with_failures(
exc=n_exc.InvalidInput(error_message='sorry'),
action='create_port')
def test_get_network_info_return_none_on_not_found(self): def test_get_network_info_return_none_on_not_found(self):
self.plugin.get_network.side_effect = n_exc.NetworkNotFound(net_id='a') self.plugin.get_network.side_effect = n_exc.NetworkNotFound(net_id='a')