diff --git a/neutron/plugins/ml2/plugin.py b/neutron/plugins/ml2/plugin.py index 1dfc44b8780..2935e1b32c6 100644 --- a/neutron/plugins/ml2/plugin.py +++ b/neutron/plugins/ml2/plugin.py @@ -313,10 +313,10 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2, if not self.mechanism_manager.ordered_mech_drivers: return aliases - supported_extensions = set([]) + supported_extensions = set(aliases) for mech_driver in self.mechanism_manager.ordered_mech_drivers: - supported_extensions |= mech_driver.obj.supported_extensions( - set(aliases)) + supported_extensions &= mech_driver.obj.supported_extensions( + supported_extensions) return list(supported_extensions) @registry.receives(resources.PORT, diff --git a/neutron/tests/unit/plugins/ml2/test_plugin.py b/neutron/tests/unit/plugins/ml2/test_plugin.py index 67139410027..9ab6543d066 100644 --- a/neutron/tests/unit/plugins/ml2/test_plugin.py +++ b/neutron/tests/unit/plugins/ml2/test_plugin.py @@ -177,15 +177,14 @@ class TestMl2FilterExtensions(Ml2PluginV2TestCase): def test__filter_extensions_by_mech_driver(self): extension_aliases = ['ext1', 'ext2', 'ext3', 'ext4', 'ext5'] supported_aliases = [{'ext0', 'ext1', 'ext2'}, - {'ext4', 'ext5', 'ext6'}] + {'ext1', 'ext5', 'ext6'}] for idx, mech_driver in enumerate( self.plugin.mechanism_manager.ordered_mech_drivers): mech_driver.obj._supported_extensions = supported_aliases[idx] supported_extensions = sorted( self.plugin._filter_extensions_by_mech_driver(extension_aliases)) - self.assertEqual(['ext1', 'ext2', 'ext4', 'ext5'], - supported_extensions) + self.assertEqual(['ext1'], supported_extensions) class TestMl2BasicGet(test_plugin.TestBasicGet, diff --git a/releasenotes/notes/change-the-way-how-api-extensions-are-filtered-out-b4449e690cb64480.yaml b/releasenotes/notes/change-the-way-how-api-extensions-are-filtered-out-b4449e690cb64480.yaml new file mode 100644 index 00000000000..7d2181bfea2 --- /dev/null +++ b/releasenotes/notes/change-the-way-how-api-extensions-are-filtered-out-b4449e690cb64480.yaml @@ -0,0 +1,13 @@ +--- +upgrade: + - | + The way the ML2 plugin filters out API extensions which are not supported + by loaded mechanism drivers has changed. + Before, the API extension was on the list if at least one of the mechanism drivers + supported it, but now the extension needs to be supported by all the mechanism + drivers. If at least one of them filters it out, it will be removed from + the final list of enabled API extensions. + Currently, only the OVN mechanism driver is filtering out some of the ML2 + API extensions, thus if that mechanism driver is loaded in Neutron with any other + mechanism driver, the list of the enabled API extensions may be smaller than it + was before.