Merge "Skip DHCP agent query in provisioning block setup"

This commit is contained in:
Jenkins 2017-03-30 01:47:14 +00:00 committed by Gerrit Code Review
commit dc84e891ca
3 changed files with 4 additions and 10 deletions

View File

@ -1019,10 +1019,7 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
def _setup_dhcp_agent_provisioning_component(self, context, port):
subnet_ids = [f['subnet_id'] for f in port['fixed_ips']]
if (db.is_dhcp_active_on_any_subnet(context, subnet_ids) and
any(self.get_configuration_dict(a).get('notifies_port_ready')
for a in self.get_dhcp_agents_hosting_networks(
context, [port['network_id']]))):
if db.is_dhcp_active_on_any_subnet(context, subnet_ids):
# at least one of the agents will tell us when the dhcp config
# is ready so we setup a provisioning component to prevent the
# port from going ACTIVE until a dhcp_ready_on_port

View File

@ -116,6 +116,9 @@ class TestL2PopulationRpcTestCase(test_plugin.Ml2PluginV2TestCase):
uptime = ('neutron.plugins.ml2.drivers.l2pop.db.get_agent_uptime')
uptime_patch = mock.patch(uptime, return_value=190)
uptime_patch.start()
# don't wait for DHCP provisioning block to clear
mock.patch('neutron.plugins.ml2.db.is_dhcp_active_on_any_subnet',
return_value=False).start()
def _setup_l3(self):
notif_p = mock.patch.object(l3_hamode_db.L3_HA_NAT_db_mixin,

View File

@ -776,12 +776,6 @@ class TestMl2PortsV2(test_plugin.TestPortsV2, Ml2PluginV2TestCase):
plugin.update_port(ctx, port['port']['id'], port)
self.assertTrue(ap.called)
def test_dhcp_provisioning_blocks_removed_without_dhcp_agents(self):
with mock.patch.object(provisioning_blocks,
'remove_provisioning_component') as cp:
with self.port():
self.assertTrue(cp.called)
def test_create_update_get_port_same_fixed_ips_order(self):
ctx = context.get_admin_context()
plugin = directory.get_plugin()