Merge "Handle IPAddressGenerationFailure during get_dhcp_port"

This commit is contained in:
Jenkins 2013-11-28 04:57:37 +00:00 committed by Gerrit Code Review
commit df3324c287
2 changed files with 6 additions and 1 deletions

View File

@ -168,7 +168,8 @@ class DhcpRpcCallbackMixin(object):
retval = plugin.create_port(context, dict(port=port_dict))
except (db_exc.DBError,
n_exc.NetworkNotFound,
n_exc.SubnetNotFound) as e:
n_exc.SubnetNotFound,
n_exc.IpAddressGenerationFailure) as e:
LOG.warn(_("Port for network %(net_id)s could not be created: "
"%(reason)s") % {"net_id": network_id, 'reason': e})
return

View File

@ -138,6 +138,10 @@ class TestDhcpRpcCallackMixin(base.BaseTestCase):
self._test_get_dhcp_port_with_failures(
raise_create_port=n_exc.SubnetNotFound(subnet_id='b'))
def test_get_dhcp_port_catch_ip_generation_failure_on_create_port(self):
self._test_get_dhcp_port_with_failures(
raise_create_port=n_exc.IpAddressGenerationFailure(net_id='a'))
def _test_get_dhcp_port_create_new(self, update_port=None):
self.plugin.get_network.return_value = dict(tenant_id='tenantid')
create_spec = dict(tenant_id='tenantid', device_id='devid',