Merge "[ML2] Change way how list of supported API extensions is made"

This commit is contained in:
Zuul 2021-06-28 00:54:46 +00:00 committed by Gerrit Code Review
commit 3127bd1d57
3 changed files with 18 additions and 6 deletions

View File

@ -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,

View File

@ -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,

View File

@ -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.