Skip DHCP agent query in provisioning block setup
Provisioning blocks merged in Newton so for Pike we can safely assume we are not running with Liberty agents that don't notify the server when the port is ready. This allows us to skip a query to the agents and configuration parsing on every port provisioning block setup. Related-Bug: #1453350 Change-Id: I8111469ad4b0d88580bff7a77492ad95af8e9377
This commit is contained in:
parent
2bf91b2f10
commit
4ba0e75254
|
@ -1221,10 +1221,7 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
|
|||
if utils.is_port_trusted(port):
|
||||
return
|
||||
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
|
||||
|
|
|
@ -115,6 +115,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,
|
||||
|
|
|
@ -813,12 +813,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()
|
||||
|
|
Loading…
Reference in New Issue