Improve core plugin extension filtering using the mechanism driver information

Bug #1888829 reported by Rodolfo Alonso on 2020-07-24
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Wishlist
Rodolfo Alonso

Bug Description

Those are the current steps to load the plugins and extensions during the Neutron server initialization:
1) The plugins are loaded. The first one is the core plugin (ML2Plugin). During the initialization, the mechanism drivers are loaded [1].

2) The PluginAwareExtensionManager is instantiated [2]. It will load all extensions from the loaded plugins, first from the core one (ML2Plugin) and then the service plugins. The extensions are defined, per plugin (and the inherited classes), in "supported_extension_aliases".
Some plugins, "Ml2Plugin" and "L3RouterPlugin", implement a non standard method (at least not defined in the ServicePluginBase abs class) to remove from the supported extensions list those ones not matching a defined criteria.

3) The PluginAwareExtensionManager extend the extension resources [3]. In this phase, some extensions will request the presence of other ones (get_required_extensions). If those requirements are not fulfilled, the server will exit with an exception.

The proposal of this RFE is to add a step in this process, between (2) and (3): each plugin will be able to revisit the list of loaded extensions and unload gracefully those ones not needed.

In this description I'm reducing the scope of this feature to just the ML2Plugin. This plugin will filter the extension list depending on the loaded mechanism drivers. If one extension is not supported by any loaded mechanism driver, it will be removed. This is very similar to the process done in (2) when "Ml2Plugin" or "L3RouterPlugin" remove those extensions not configured or not supported.

In order to allow each mechanism driver to filter the loaded extensions, the mechanism driver will have two lists:
- A list of supported extensions.
- A list of not supported extensions.

In some cases, it will be easier to maintain only this list of not supported extensions (could be shorter).

If a mechanism driver does not have any of those lists populated (by default), the behavior will be current one, keeping backwards compatibility.

[1]https://github.com/openstack/neutron/blob/13c5fc4ddd70aba7909f017f49b1047d2af1482b/neutron/plugins/ml2/managers.py#L428
[2]https://github.com/openstack/neutron/blob/a388701ddfe628e9a5bd16a78422164799b11ef8/neutron/pecan_wsgi/startup.py#L40
[3]https://github.com/openstack/neutron/blob/a388701ddfe628e9a5bd16a78422164799b11ef8/neutron/pecan_wsgi/startup.py#L41

Changed in neutron:
assignee: nobody → Rodolfo Alonso (rodolfo-alonso-hernandez)
importance: Undecided → Wishlist

Related fix proposed to branch: master
Review: https://review.opendev.org/743799

Reviewed: https://review.opendev.org/743519
Committed: https://git.openstack.org/cgit/openstack/neutron-lib/commit/?id=b4e33e5e7aba062027765ed56912ad8da4ca8351
Submitter: Zuul
Branch: master

commit b4e33e5e7aba062027765ed56912ad8da4ca8351
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Mon Jul 27 18:06:35 2020 +0000

    Add "supported_extensions" method to MechanismDriver

    This method returns the supported plugin extensions, given a
    set of them. Each mechanism driver will be able to implement each
    own filtering method.

    By default, the method will return the same set of extensions
    without any filtering.

    Related-Bug: #1888829

    Change-Id: I6fd62f6f393b635e6710020adab736a09a142556

Reviewed: https://review.opendev.org/743767
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=5f6e37f966a627670480429d153a21631e170c20
Submitter: Zuul
Branch: master

commit 5f6e37f966a627670480429d153a21631e170c20
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Wed Jul 29 11:49:31 2020 +0000

    Filter ML2Plugin mech driver supported extensions

    Each mechanism driver loaded in the ML2Plugin can provide what
    extensions are supported. By default, any mech driver can support
    all extensions.

    This extension filtering is done during the plugin initialization.
    If any requested extension is not supported, it will be silently
    removed from the loaded extensions.

    Depends-On: https://review.opendev.org/#/c/743519
    Related-Bug: #1888829

    Change-Id: Id4809d4f3c4e13a93f9160df3618f8602b57437c

Reviewed: https://review.opendev.org/743799
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=ebb866310b48cbad2ae772e0551aaf994858a51e
Submitter: Zuul
Branch: master

commit ebb866310b48cbad2ae772e0551aaf994858a51e
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Wed Jul 29 16:31:36 2020 +0000

    Filter supported extension for OVN mech driver

    OVN mechanism driver has support for a defined set of ML2 API
    extensions. When the ML2Plugin is loaded, the OVN mechanism driver
    will return, from the loaded plugin extensions, only the supported
    subset.

    Change-Id: Id23aa1c107504d47b08007752159b07f089c3090
    Related-Bug: #1888829

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers