[OVN] Add support for WSGI mod

Bug #1912359 reported by Lucas Alvares Gomes
40
This bug affects 6 people
Affects Status Importance Assigned to Milestone
neutron
Fix Released
High
Rodolfo Alonso

Bug Description

Currently the OVN driver initialization does not work with uWSGI because the initialization is different than eventlet and the post_fork_initialization() method [0] does not get called in the process.

The post_fork_initialization() method is the one responsible for a few things:

* Starting the OVN database connections
* Starting the maintenance task
* Overwriting the agent and availability zone methods for OVN use [1]
* Running the database synchronization script (in log or repair mode) [2]

These steps would need to be factored out to adhere to the uWSGI initialization process.

[0] https://github.com/openstack/neutron/blob/19de0598227e2156b26f6d5eca874eaba09106a7/neutron/plugins/ml2/drivers/ovn/mech_driver/mech_driver.py#L181-L186

[1] https://github.com/openstack/neutron/blob/19de0598227e2156b26f6d5eca874eaba09106a7/neutron/plugins/ml2/drivers/ovn/mech_driver/mech_driver.py#L284-L292

[2] https://github.com/openstack/neutron/blob/19de0598227e2156b26f6d5eca874eaba09106a7/neutron/plugins/ml2/drivers/ovn/mech_driver/mech_driver.py#L300-L315

How to reproduce:

Deploy Devstack with OVN (https://docs.openstack.org/neutron/latest/contributor/testing/ovn_devstack.html) with NEUTRON_DEPLOY_MOD_WSGI=True set in local.conf.

Tags: ovn
tags: added: ovn rfe
Changed in neutron:
importance: Undecided → Wishlist
Revision history for this message
Slawek Kaplonski (slaweq) wrote :

I don't think this is an rfe which we need to discuss in the drivers team and approve. For me it is just yet another feature parity gap which we should close ASAP. So I will remove "rfe" tag from that and lets keep it as a bug.

tags: removed: rfe
Changed in neutron:
importance: Wishlist → High
summary: - [OVN] [RFE] Add support for WSGI mod
+ [OVN] Add support for WSGI mod
Revision history for this message
Rabi Mishra (rabi) wrote :

Any plans for fixing this soon? Looks like this would need some major refactoring?

Changed in neutron:
status: New → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to neutron (master)

Related fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/neutron/+/922074

Changed in neutron:
assignee: nobody → Rodolfo Alonso (rodolfo-alonso-hernandez)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/neutron/+/922470

Changed in neutron:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to neutron (master)

Related fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/neutron/+/922613

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Related fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/neutron/+/923198

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to neutron (master)

Reviewed: https://review.opendev.org/c/openstack/neutron/+/922074
Committed: https://opendev.org/openstack/neutron/commit/980f9bdab2f8a0895bb0373fc73788cec93ee649
Submitter: "Zuul (22348)"
Branch: master

commit 980f9bdab2f8a0895bb0373fc73788cec93ee649
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Mon Jun 17 07:10:03 2024 +0000

    [OVN] Add a new process to spawn ML2/OVN maintenance worker

    When using the Neutron WSGI module, the ML2/OVN maintenance worker needs
    to be spawned in a separate service. This patch adds the service
    ``neutron-ovn-maintenance-worker``, that is a single process service tha
    runs the ``MaintenanceWorker`` instance. This process is in charge of
    performing periodic routines related to the ML2/OVN driver.

    This new service should be included in any deployment project that
    allows to spawn Neutron ML2/OVN with WSGI. Along with this patch, a new
    one for devstack will be proposed.

    Related-Bug: #1912359
    Change-Id: Iea2995adb3343aae74a1b617fbccfce5c62c6b87

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.opendev.org/c/openstack/neutron/+/922470
Committed: https://opendev.org/openstack/neutron/commit/cfab008eef3d11055ad16b8dd0d49aaa1801bc95
Submitter: "Zuul (22348)"
Branch: master

commit cfab008eef3d11055ad16b8dd0d49aaa1801bc95
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Fri Jun 21 12:39:24 2024 +0000

    [OVN] Enable the WSGI module for the OVN mechanism driver

    This patch enables the use of the WSGI module with the ML2/OVN
    mechanism driver. The ML2/OVN requires two events that are called
    during the Neutron eventlet server initialization:
    * BEFORE_SPAWN: called once before the API workers have been created
      and after the ML2 plugin code has been initalizated.
    * AFTER_INIT: called when the API worker is started; at this point
      the different worker processes have been spawned.

    The WSGI module didn't make these event calls. Now these events are
    called during the API server initialization, after the ML2 plugin
    has been initalizated but before the server is running and attending
    any request.

    This approach differs from the Neutron eventlet server event calls
    because the BEFORE_SPAWN event is called for all API workers; that
    means the method ``OVNMechanismDriver.pre_fork_initialize`` is called
    as many times as workers are configured.

    Closes-Bug: #1912359
    Change-Id: I684c6cea620308a6617b665400ce608650a2adfd

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (master)

Change abandoned by "Rodolfo Alonso <email address hidden>" on branch: master
Review: https://review.opendev.org/c/openstack/neutron/+/922613
Reason: neutron patch merged, devstack one under review

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to neutron (master)

Reviewed: https://review.opendev.org/c/openstack/neutron/+/923198
Committed: https://opendev.org/openstack/neutron/commit/308db2e048754e6b35eca625dee6bad1971b1055
Submitter: "Zuul (22348)"
Branch: master

commit 308db2e048754e6b35eca625dee6bad1971b1055
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Sat Jun 29 16:58:18 2024 +0000

    [OVN] Release note for ``neutron-ovn-maintenance-worker`` process

    Related-Bug: #1912359
    Change-Id: Ic7f7edb22c2824a841a7b978b5b3c8eff68fb281

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

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.