Public bug reported:

It was observed in a dcn environment where compute hostnames overlapped,
like compute-0 and dcn1-compute-0, and the current code filters both of
these host when any of these as passed as filter i.e
host=dcn1-compute-0.

Operation:- openstack port create --network dcn1-public --host
dcn1-compute-0 port1

Fails as:-
2025-05-06 13:47:55.433 17 INFO 
neutron.plugins.ml2.drivers.ovn.mech_driver.mech_driver [None 
req-d4108c07-ba6a-467b-9b90-3d4d2a848fe3 376d4365073844daae419672441d3bc1 
8d7a61145d2347b8ba7eb5f7c28cd4ae - - default default] Refusing to bind port 
618b3861-f36e-4f37-8b24-83ba8bcff143 on host dcn1-compute-0 due to the OVN 
chassis bridge mapping physical networks ['datacentre'] not supporting physical 
network: leaf1
2025-05-06 13:47:55.433 17 ERROR neutron.plugins.ml2.managers [None 
req-d4108c07-ba6a-467b-9b90-3d4d2a848fe3 376d4365073844daae419672441d3bc1 
8d7a61145d2347b8ba7eb5f7c28cd4ae - - default default] Failed to bind port 
618b3861-f36e-4f37-8b24-83ba8bcff143 on host dcn1-compute-0 for vnic_type 
normal using segments [{'id': 'c36c1b38-cee5-4d1a-ab68-3638e221695a', 
'network_type': 'flat', 'physical_network': 'leaf1', 'segmentation_id': None, 
'network_id': '4f35cb1c-69d7-4582-b3a5-0cf380c56f62'}]

compute-0 - ovn-bridge-mappings=datacentre:br-ex
dcn1-compute-0 - ovn-bridge-mappings=leaf1:br-ex

Even the bridge mappings on dcn1-compute-0 is correct we can see the
failure as it's not filtering correctly the hosts. This needs to be
fixed.

Current code is:-
https://github.com/openstack/neutron/blob/123bd115f3b65ba09560685ad6cf68c6934a6535/neutron/plugins/ml2/drivers/ovn/agent/neutron_agent.py#L290C1-L298C26

    def get_agents(self, filters=None):
        filters = filters or {}
        agent_list = []
        for agent in self:
            agent_dict = agent.as_dict()
            if all(agent_dict[k] in v for k, v in filters.items()):
                agent_list.append(agent)
        return agent_list 

Originally reported at https://issues.redhat.com/browse/OSPRH-16439

** Affects: neutron
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/2110094

Title:
  OVN AgentCache get_agents method filters agents incorrectly if
  hostname overlaps

Status in neutron:
  New

Bug description:
  It was observed in a dcn environment where compute hostnames
  overlapped, like compute-0 and dcn1-compute-0, and the current code
  filters both of these host when any of these as passed as filter i.e
  host=dcn1-compute-0.

  Operation:- openstack port create --network dcn1-public --host
  dcn1-compute-0 port1

  Fails as:-
  2025-05-06 13:47:55.433 17 INFO 
neutron.plugins.ml2.drivers.ovn.mech_driver.mech_driver [None 
req-d4108c07-ba6a-467b-9b90-3d4d2a848fe3 376d4365073844daae419672441d3bc1 
8d7a61145d2347b8ba7eb5f7c28cd4ae - - default default] Refusing to bind port 
618b3861-f36e-4f37-8b24-83ba8bcff143 on host dcn1-compute-0 due to the OVN 
chassis bridge mapping physical networks ['datacentre'] not supporting physical 
network: leaf1
  2025-05-06 13:47:55.433 17 ERROR neutron.plugins.ml2.managers [None 
req-d4108c07-ba6a-467b-9b90-3d4d2a848fe3 376d4365073844daae419672441d3bc1 
8d7a61145d2347b8ba7eb5f7c28cd4ae - - default default] Failed to bind port 
618b3861-f36e-4f37-8b24-83ba8bcff143 on host dcn1-compute-0 for vnic_type 
normal using segments [{'id': 'c36c1b38-cee5-4d1a-ab68-3638e221695a', 
'network_type': 'flat', 'physical_network': 'leaf1', 'segmentation_id': None, 
'network_id': '4f35cb1c-69d7-4582-b3a5-0cf380c56f62'}]

  compute-0 - ovn-bridge-mappings=datacentre:br-ex
  dcn1-compute-0 - ovn-bridge-mappings=leaf1:br-ex

  Even the bridge mappings on dcn1-compute-0 is correct we can see the
  failure as it's not filtering correctly the hosts. This needs to be
  fixed.

  Current code is:-
  
https://github.com/openstack/neutron/blob/123bd115f3b65ba09560685ad6cf68c6934a6535/neutron/plugins/ml2/drivers/ovn/agent/neutron_agent.py#L290C1-L298C26

      def get_agents(self, filters=None):
          filters = filters or {}
          agent_list = []
          for agent in self:
              agent_dict = agent.as_dict()
              if all(agent_dict[k] in v for k, v in filters.items()):
                  agent_list.append(agent)
          return agent_list 

  Originally reported at https://issues.redhat.com/browse/OSPRH-16439

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/2110094/+subscriptions


-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : yahoo-eng-team@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to