Fix port_hardware_offload_type ML2 extension

This patch fixes 2 issues related to that port_hardware_offload_type
extension:

1. API extension is now not supported by the ML2 plugin directly so if
   ml2 extension is not loaded Neutron will not report that API
   extension is available,
2. Fix error 500 when creating port with hardware_offload_type
   attribute set but when binding:profile is not set (is of type
   Sentinel).

Conflicts:
    neutron/plugins/ml2/plugin.py

Closes-bug: #2078432
Closes-bug: #2078434
Change-Id: Ib0038dd39d8d210104ee8a70e4519124f09292da
(cherry picked from commit fbb7c9ae3d672796b72b796c53f89865ea6b3763)
This commit is contained in:
Slawek Kaplonski 2024-08-30 11:50:55 +02:00
parent 3b95423d99
commit 03ddc0f6fd
2 changed files with 1 additions and 3 deletions

View File

@ -41,7 +41,7 @@ class PortHardwareOffloadTypeDbMixin(object):
if hw_type not in capabilities:
capabilities.append(hw_type)
data[portbindings.PROFILE]['capabilities'] = capabilities
except KeyError:
except (AttributeError, KeyError):
data[portbindings.PROFILE] = {'capabilities': [hw_type]}
def _extend_port_dict(self, port_db, result):

View File

@ -43,7 +43,6 @@ from neutron_lib.api.definitions import network_mtu as mtu_apidef
from neutron_lib.api.definitions import network_mtu_writable as mtuw_apidef
from neutron_lib.api.definitions import port as port_def
from neutron_lib.api.definitions import port_device_profile as pdp_def
from neutron_lib.api.definitions import port_hardware_offload_type as phot_def
from neutron_lib.api.definitions import port_mac_address_override
from neutron_lib.api.definitions import port_mac_address_regenerate
from neutron_lib.api.definitions import port_numa_affinity_policy as pnap_def
@ -246,7 +245,6 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
port_mac_address_override.ALIAS,
sg_default_rules_ext.ALIAS,
sg_rules_default_sg.ALIAS,
phot_def.ALIAS,
]
# List of agent types for which all binding_failed ports should try to be