From 33641c7cff501280cebf84b1c7c85f5509b06205 Mon Sep 17 00:00:00 2001 From: Mateus Nascimento Date: Thu, 5 Jun 2025 15:41:05 -0300 Subject: [PATCH] Add SR-IOV bridge mappings for DHCP support Bridge mappings for SR-IOV networks were missing from the OVS configs. This prevented the DHCP helper ports on SR-IOV subnets from binding, leaving them in the DOWN state and causing instances to boot without networking when DHCP was enabled. These modifications add br-phy* bridges for any SR-IOV interface, mirroring the logic already used for standard Ethernet ports. Both _get_host_bridges and _get_dynamic_ovs_agent_config now examine SR-IOV interfaces and append the appropriate br-phy* mapping and bridge-to-data network pairing. Test Plan: [PASS] Create an OpenStack network using a SR-IOV data-network provider [PASS] Verify that the DHCP OVS port is correctly bound [PASS] Create two VMs on the SR-IOV network [PASS] Ping between the two VMs and confirm network connectivity Story: 2011263 Task: 51893 Change-Id: I47e730bb59af159aba17aede2ec0e4b256985230 Signed-off-by: Mateus Nascimento --- .../k8sapp_openstack/helm/neutron.py | 39 +++++++++---------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/python3-k8sapp-openstack/k8sapp_openstack/k8sapp_openstack/helm/neutron.py b/python3-k8sapp-openstack/k8sapp_openstack/k8sapp_openstack/helm/neutron.py index fbeb69d8..1e6b5428 100644 --- a/python3-k8sapp-openstack/k8sapp_openstack/k8sapp_openstack/helm/neutron.py +++ b/python3-k8sapp-openstack/k8sapp_openstack/k8sapp_openstack/helm/neutron.py @@ -153,7 +153,7 @@ class NeutronHelm(openstack.OpenstackBaseHelm): bridges = {} index = 0 for iface in self.interfaces_by_hostid.get(host.id, []): - if self._is_data_network_type(iface): + if self._is_data_network_type(iface) or self._is_sriov_network_type(iface): if any(dn.datanetwork_network_type in [constants.DATANETWORK_TYPE_FLAT, constants.DATANETWORK_TYPE_VLAN] for dn in @@ -171,25 +171,24 @@ class NeutronHelm(openstack.OpenstackBaseHelm): bridge_mappings = "" index = 0 for iface in self.interfaces_by_hostid.get(host.id, []): - if self._is_data_network_type(iface): - # obtain the assigned bridge for interface - brname = 'br-phy%d' % index - if brname: - datanets = self.ifdatanets_by_ifaceid.get(iface.id, []) - for datanet in datanets: - dn_name = datanet['datanetwork_name'].strip() - LOG.debug('_get_dynamic_ovs_agent_config ' - 'host=%s datanet=%s', host.hostname, dn_name) - if (datanet.datanetwork_network_type == - constants.DATANETWORK_TYPE_VXLAN): - local_ip = self._get_interface_primary_address( - self.context, host, iface) - tunnel_types = constants.DATANETWORK_TYPE_VXLAN - elif (datanet.datanetwork_network_type in - [constants.DATANETWORK_TYPE_FLAT, - constants.DATANETWORK_TYPE_VLAN]): - bridge_mappings += ('%s:%s,' % (dn_name, brname)) - index += 1 + if self._is_data_network_type(iface) or self._is_sriov_network_type(iface): + datanets = self.ifdatanets_by_ifaceid.get(iface.id, []) + for datanet in datanets: + dn_name = datanet['datanetwork_name'].strip() + LOG.debug('_get_dynamic_ovs_agent_config ' + 'host=%s datanet=%s', host.hostname, dn_name) + if (self._is_data_network_type(iface) and + datanet.datanetwork_network_type == + constants.DATANETWORK_TYPE_VXLAN): + local_ip = self._get_interface_primary_address( + self.context, host, iface) + tunnel_types = constants.DATANETWORK_TYPE_VXLAN + elif (datanet.datanetwork_network_type in + [constants.DATANETWORK_TYPE_FLAT, + constants.DATANETWORK_TYPE_VLAN]): + brname = 'br-phy%d' % index + bridge_mappings += ('%s:%s,' % (dn_name, brname)) + index += 1 agent = {} ovs = {