diff --git a/neutron/plugins/ml2/drivers/ovn/mech_driver/mech_driver.py b/neutron/plugins/ml2/drivers/ovn/mech_driver/mech_driver.py index 37c0a01ac3b..efff559dc24 100644 --- a/neutron/plugins/ml2/drivers/ovn/mech_driver/mech_driver.py +++ b/neutron/plugins/ml2/drivers/ovn/mech_driver/mech_driver.py @@ -920,7 +920,9 @@ class OVNMechanismDriver(api.MechanismDriver): # OVN chassis information is needed to ensure a valid port bind. # Collect port binding data and refuse binding if the OVN chassis # cannot be found or is dead. - agents = n_agent.AgentCache().get_agents({'host': context.host}) + agents = n_agent.AgentCache().get_agents( + {'host': context.host, + 'agent_type': ovn_const.OVN_CONTROLLER_TYPES}) if not agents: LOG.warning('Refusing to bind port %(port_id)s due to ' 'no OVN chassis for host: %(host)s', diff --git a/neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py b/neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py index f5fabcb3ffe..5086a05e378 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py +++ b/neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py @@ -1159,7 +1159,8 @@ class TestOVNMechanismDriver(TestOVNMechanismDriverBase): fake_port, fake_host, fake_segments) self.mech_driver.bind_port(fake_port_context) neutron_agent.AgentCache().get_agents.assert_called_once_with( - {'host': fake_host}) + {'host': fake_host, + 'agent_type': ovn_const.OVN_CONTROLLER_TYPES}) fake_port_context.set_binding.assert_not_called() def test_bind_port_host_not_found(self): @@ -1189,7 +1190,8 @@ class TestOVNMechanismDriver(TestOVNMechanismDriverBase): fake_port, fake_host, fake_segments) self.mech_driver.bind_port(fake_port_context) neutron_agent.AgentCache().get_agents.assert_called_once_with( - {'host': fake_host}) + {'host': fake_host, + 'agent_type': ovn_const.OVN_CONTROLLER_TYPES}) fake_port_context.set_binding.assert_called_once_with( fake_segments[0]['id'], portbindings.VIF_TYPE_OVS, @@ -1204,7 +1206,8 @@ class TestOVNMechanismDriver(TestOVNMechanismDriverBase): fake_port, fake_host, fake_segments) self.mech_driver.bind_port(fake_port_context) neutron_agent.AgentCache().get_agents.assert_called_once_with( - {'host': fake_host}) + {'host': fake_host, + 'agent_type': ovn_const.OVN_CONTROLLER_TYPES}) fake_port_context.set_binding.assert_called_once_with( fake_segments[0]['id'], portbindings.VIF_TYPE_OVS, @@ -1225,7 +1228,8 @@ class TestOVNMechanismDriver(TestOVNMechanismDriverBase): fake_port, fake_host, fake_segments) self.mech_driver.bind_port(fake_port_context) neutron_agent.AgentCache().get_agents.assert_called_once_with( - {'host': fake_host}) + {'host': fake_host, + 'agent_type': ovn_const.OVN_CONTROLLER_TYPES}) fake_port_context.set_binding.assert_called_once_with( fake_segments[0]['id'], portbindings.VIF_TYPE_OVS,