Skip to content

Commit 089fdcc

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "[OVN] Try to bind ports only to the ovn-controller agents" into stable/yoga
2 parents c9c170d + 601b01f commit 089fdcc

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

neutron/plugins/ml2/drivers/ovn/mech_driver/mech_driver.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,9 @@ def bind_port(self, context):
984984
LOG.error('Validation of binding profile unexpectedly failed '
985985
'while attempting to bind port %s', port['id'])
986986
raise e
987-
agents = n_agent.AgentCache().get_agents({'host': bind_host})
987+
agents = n_agent.AgentCache().get_agents(
988+
{'host': bind_host,
989+
'agent_type': ovn_const.OVN_CONTROLLER_TYPES})
988990
if not agents:
989991
LOG.warning('Refusing to bind port %(port_id)s due to '
990992
'no OVN chassis for host: %(host)s',

neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,7 +1233,8 @@ def _test_bind_port_failed(self, fake_segments):
12331233
fake_port, fake_host, fake_segments)
12341234
self.mech_driver.bind_port(fake_port_context)
12351235
neutron_agent.AgentCache().get_agents.assert_called_once_with(
1236-
{'host': fake_host})
1236+
{'host': fake_host,
1237+
'agent_type': ovn_const.OVN_CONTROLLER_TYPES})
12371238
fake_port_context.set_binding.assert_not_called()
12381239

12391240
def test_bind_port_host_not_found(self):
@@ -1263,7 +1264,8 @@ def _test_bind_port(self, fake_segments):
12631264
fake_port, fake_host, fake_segments)
12641265
self.mech_driver.bind_port(fake_port_context)
12651266
neutron_agent.AgentCache().get_agents.assert_called_once_with(
1266-
{'host': fake_host})
1267+
{'host': fake_host,
1268+
'agent_type': ovn_const.OVN_CONTROLLER_TYPES})
12671269
fake_port_context.set_binding.assert_called_once_with(
12681270
fake_segments[0]['id'],
12691271
portbindings.VIF_TYPE_OVS,
@@ -1280,7 +1282,8 @@ def _test_bind_port_sriov(self, fake_segments):
12801282
fake_port, fake_host, fake_segments)
12811283
self.mech_driver.bind_port(fake_port_context)
12821284
neutron_agent.AgentCache().get_agents.assert_called_once_with(
1283-
{'host': fake_host})
1285+
{'host': fake_host,
1286+
'agent_type': ovn_const.OVN_CONTROLLER_TYPES})
12841287
fake_port_context.set_binding.assert_called_once_with(
12851288
fake_segments[0]['id'],
12861289
portbindings.VIF_TYPE_OVS,
@@ -1310,7 +1313,8 @@ def _test_bind_port_remote_managed(self, fake_segments):
13101313
fake_port, fake_host, fake_segments)
13111314
self.mech_driver.bind_port(fake_port_context)
13121315
neutron_agent.AgentCache().get_agents.assert_called_once_with(
1313-
{'host': fake_smartnic_dpu})
1316+
{'host': fake_smartnic_dpu,
1317+
'agent_type': ovn_const.OVN_CONTROLLER_TYPES})
13141318
fake_port_context.set_binding.assert_called_once_with(
13151319
fake_segments[0]['id'],
13161320
portbindings.VIF_TYPE_OVS,
@@ -1331,7 +1335,8 @@ def test_bind_port_vdpa(self):
13311335
fake_port, fake_host, fake_segments)
13321336
self.mech_driver.bind_port(fake_port_context)
13331337
neutron_agent.AgentCache().get_agents.assert_called_once_with(
1334-
{'host': fake_host})
1338+
{'host': fake_host,
1339+
'agent_type': ovn_const.OVN_CONTROLLER_TYPES})
13351340
fake_port_context.set_binding.assert_called_once_with(
13361341
fake_segments[0]['id'],
13371342
portbindings.VIF_TYPE_OVS,

0 commit comments

Comments
 (0)