Merge "Skip DHCP provisioning block for network ports"
This commit is contained in:
commit
2a64fabd52
neutron
@ -1161,6 +1161,11 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
|
|||||||
raise psec.PortSecurityAndIPRequiredForSecurityGroups()
|
raise psec.PortSecurityAndIPRequiredForSecurityGroups()
|
||||||
|
|
||||||
def _setup_dhcp_agent_provisioning_component(self, context, port):
|
def _setup_dhcp_agent_provisioning_component(self, context, port):
|
||||||
|
# NOTE(kevinbenton): skipping network ports is a workaround for
|
||||||
|
# the fact that we don't issue dhcp notifications from internal
|
||||||
|
# port creation like router ports and dhcp ports via RPC
|
||||||
|
if utils.is_port_trusted(port):
|
||||||
|
return
|
||||||
subnet_ids = [f['subnet_id'] for f in port['fixed_ips']]
|
subnet_ids = [f['subnet_id'] for f in port['fixed_ips']]
|
||||||
if (db.is_dhcp_active_on_any_subnet(context, subnet_ids) and
|
if (db.is_dhcp_active_on_any_subnet(context, subnet_ids) and
|
||||||
any(self.get_configuration_dict(a).get('notifies_port_ready')
|
any(self.get_configuration_dict(a).get('notifies_port_ready')
|
||||||
|
@ -688,6 +688,13 @@ class TestMl2PortsV2(test_plugin.TestPortsV2, Ml2PluginV2TestCase):
|
|||||||
with self.port():
|
with self.port():
|
||||||
self.assertTrue(ap.called)
|
self.assertTrue(ap.called)
|
||||||
|
|
||||||
|
def test_dhcp_provisioning_blocks_skipped_with_network_port(self):
|
||||||
|
self._add_fake_dhcp_agent()
|
||||||
|
with mock.patch.object(provisioning_blocks,
|
||||||
|
'add_provisioning_component') as ap:
|
||||||
|
with self.port(device_owner=constants.DEVICE_OWNER_DHCP):
|
||||||
|
self.assertFalse(ap.called)
|
||||||
|
|
||||||
def test_dhcp_provisioning_blocks_skipped_on_create_with_no_dhcp(self):
|
def test_dhcp_provisioning_blocks_skipped_on_create_with_no_dhcp(self):
|
||||||
self._add_fake_dhcp_agent()
|
self._add_fake_dhcp_agent()
|
||||||
with self.subnet(enable_dhcp=False) as subnet:
|
with self.subnet(enable_dhcp=False) as subnet:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user