diff --git a/neutron/agent/linux/dhcp.py b/neutron/agent/linux/dhcp.py index c6153027a52..0cc73d5f808 100644 --- a/neutron/agent/linux/dhcp.py +++ b/neutron/agent/linux/dhcp.py @@ -767,7 +767,8 @@ class DeviceManager(object): port_fixed_ips.extend( [dict(subnet_id=s) for s in dhcp_enabled_subnet_ids]) dhcp_port = self.plugin.update_dhcp_port( - port.id, {'port': {'fixed_ips': port_fixed_ips}}) + port.id, {'port': {'network_id': network.id, + 'fixed_ips': port_fixed_ips}}) if not dhcp_port: raise exceptions.Conflict() else: @@ -784,7 +785,8 @@ class DeviceManager(object): port_device_id = getattr(port, 'device_id', None) if port_device_id == constants.DEVICE_ID_RESERVED_DHCP_PORT: dhcp_port = self.plugin.update_dhcp_port( - port.id, {'port': {'device_id': device_id}}) + port.id, {'port': {'network_id': network.id, + 'device_id': device_id}}) if dhcp_port: break diff --git a/neutron/db/dhcp_rpc_base.py b/neutron/db/dhcp_rpc_base.py index 106ad5ed7a0..e42099c63c3 100644 --- a/neutron/db/dhcp_rpc_base.py +++ b/neutron/db/dhcp_rpc_base.py @@ -71,9 +71,10 @@ class DhcpRpcCallbackMixin(object): pass else: ctxt.reraise = True - network_id = port['port']['network_id'] - LOG.warn(_("Port for network %(net_id)s could not be created: " - "%(reason)s") % {"net_id": network_id, 'reason': e}) + net_id = port['port']['network_id'] + LOG.warn(_("Action %(action)s for network %(net_id)s " + "could not complete successfully: %(reason)s") + % {"action": action, "net_id": net_id, 'reason': e}) def get_active_networks(self, context, **kwargs): """Retrieve and return a list of the active network ids.""" diff --git a/neutron/tests/unit/test_dhcp_agent.py b/neutron/tests/unit/test_dhcp_agent.py index 5f58b8c00d2..ebe2be4c04a 100644 --- a/neutron/tests/unit/test_dhcp_agent.py +++ b/neutron/tests/unit/test_dhcp_agent.py @@ -1180,6 +1180,7 @@ class TestDeviceManager(base.BaseTestCase): plugin.update_dhcp_port.return_value = fake_network.ports[0] dh.setup_dhcp_port(fake_network_copy) port_body = {'port': { + 'network_id': fake_network.id, 'fixed_ips': [{'subnet_id': fake_fixed_ip1.subnet_id, 'ip_address': fake_fixed_ip1.ip_address}, {'subnet_id': fake_subnet2.id}]}}