[OVN] Router "router_extra_attributes" register is not created

Bug #1995974 reported by Rodolfo Alonso
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Medium
Rodolfo Alonso

Bug Description

When Neutron uses ML2/OVN mech driver, the router "router_extra_attributes" register is not created.

With ML2/OVS, this register is created when it is called from:
* l3_dvr_db: to set the "dvr" flag.
* l3_hamode_db: to set the "ha" flag.
* availability_zone/router: to set the "availability_zone_hints" list

Because those methods are registered when the ML2 plugin is called as resource extenders, every time a router is created those method are called. Those methods always check if the child register "router_extra_attributes" is created. If not, it is added to the session [1].

Some projects, like n-d-r, are expecting those extra attributes in their queries; for example: [2].

[1]https://github.com/openstack/neutron/blob/9e2a0ac058305dd16d6dedb883d305cd162f5fe4/neutron/db/l3_attrs_db.py#L48-L54
[2]https://review.opendev.org/c/openstack/neutron-dynamic-routing/+/863713

Changed in neutron:
assignee: nobody → Rodolfo Alonso (rodolfo-alonso-hernandez)
importance: Undecided → Medium
Changed in neutron:
status: New → In Progress
Revision history for this message
Rodolfo Alonso (rodolfo-alonso-hernandez) wrote :
Revision history for this message
Roberto Acosta (roberto-acosta) wrote :
Download full text (3.3 KiB)

Thank you very much Rodolfo!
This patch works for routers already created.

Some debugs below:

Nov 17 17:48:47 os-infra-1-neutron-server-container-819795c0 neutron-server[1242]: 2022-11-17 17:48:47.301 1242 DEBUG futurist.periodics [req-2e9d417a-0eaf-4628-b061-f6800dc3e42a - - - - -] Submitting immediate callback 'neutron.plugins.ml2.drivers.ovn.mech_driver.ovsdb.maintenance.DBInconsistenciesPeriodics.create_router_extra_attributes_registers' _process_immediates /usr/lib/python3/dist-packages/futurist/periodics.py:676
Nov 17 17:48:47 os-infra-1-neutron-server-container-819795c0 neutron-server[1242]: 2022-11-17 17:48:47.508 1242 DEBUG futurist.periodics [req-2e9d417a-0eaf-4628-b061-f6800dc3e42a - - - - -] Periodic callback 'neutron.plugins.ml2.drivers.ovn.mech_driver.ovsdb.maintenance.DBInconsistenciesPeriodics.create_router_extra_attributes_registers' raised 'NeverAgain' exception, stopping any further execution of it. _on_done /usr/lib/python3/dist-packages/futurist/periodics.py:713

MariaDB [neutron]>
MariaDB [neutron]> select * from router_extra_attributes;
+--------------------------------------+-------------+----------------+----+----------+-------------------------+
| router_id | distributed | service_router | ha | ha_vr_id | availability_zone_hints |
+--------------------------------------+-------------+----------------+----+----------+-------------------------+
| 122a76ab-5d77-4eb1-a0c2-9cb1816d39b7 | 0 | 0 | 0 | 0 | [] |
| 6a20498b-9120-4d5b-8cb7-d02e6d5eac02 | 0 | 0 | 0 | 0 | [] |
+--------------------------------------+-------------+----------------+----+----------+-------------------------+
2 rows in set (0.001 sec)

MariaDB [neutron]> select * from routers;
+----------------------------------+--------------------------------------+---------+--------+----------------+--------------------------------------+-------------+------------------+-----------+
| project_id | id | name | status | admin_state_up | gw_port_id | enable_snat | standard_attr_id | flavor_id |
+----------------------------------+--------------------------------------+---------+--------+----------------+--------------------------------------+-------------+------------------+-----------+
| 26dc9f1085fa4688a08e803cfb374540 | 122a76ab-5d77-4eb1-a0c2-9cb1816d39b7 | router2 | ACTIVE | 1 | 5745084a-9313-4eba-93b1-44f86018ccb8 | 1 | 374 | NULL |
| d11daecfe9d847ddb7d9ce2932c2fe26 | 6a20498b-9120-4d5b-8cb7-d02e6d5eac02 | router1 | ACTIVE | 1 | f767ae07-5856-4a76-8e7b-dfe675ffac56 | 1 | 368 | NULL |
+----------------------------------+--------------------------------------+---------+--------+----------------+--------------------------------------+-------------+------------------+-----------+
2 rows in set (0.001 sec)

MariaDB [neutron]>

root@jump-host:~# openstack bgp speaker list advertised routes bgpspeaker
+----------------------+-----------------------+
| Destination ...

Read more...

Revision history for this message
Rodolfo Alonso (rodolfo-alonso-hernandez) wrote :

Hello Roberto:

Nice to read that!

Regards.

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

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

commit 2081910d6d942d49d96297884a932ff93acb8759
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Fri Nov 11 12:57:05 2022 +0100

    Always create a "router_extra_attributes" register per router

    The table "router_extra_attributes" is a child of "router" table.
    Each register contains extra information that completes the router
    description. When using ML2/OVS mechanism driver, the methods that
    create and populate the "router_extra_attributes" register are always
    called from the L3 DVR, L3 HA and availability zones extensions.

    When using ML2/OVN, those extensions are not loaded and therefore the
    "router_extra_attributes" register is not created.

    Despite this register is currently not used in ML2/OVN (it will be in
    future features), there are some project expecting the
    "router_extra_attributes" register to be always created (for example,
    neutron-dynamic-routing [1]).

    This patch enforces the child register creating always when a router is
    created. This register is populated with the default values. This new
    register does not affect any current operation related to ML2/OVN nor
    ML2/OVS.

    There is a 1:1 relationship between "routers" and
    "router_extra_attributes". The child register is deleted by the database
    engine when the "routers" register is deleted (ondelete="CASCADE").

    [1]https://review.opendev.org/c/openstack/neutron-dynamic-routing/+/863713

    Closes-Bug: #1995974
    Change-Id: Ic546e40513402fa101c9687acce382cd6b84356c

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/zed)

Fix proposed to branch: stable/zed
Review: https://review.opendev.org/c/openstack/neutron/+/865380

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/yoga)

Fix proposed to branch: stable/yoga
Review: https://review.opendev.org/c/openstack/neutron/+/865387

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/xena)

Fix proposed to branch: stable/xena
Review: https://review.opendev.org/c/openstack/neutron/+/865389

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/wallaby)

Fix proposed to branch: stable/wallaby
Review: https://review.opendev.org/c/openstack/neutron/+/865412

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

Reviewed: https://review.opendev.org/c/openstack/neutron/+/865380
Committed: https://opendev.org/openstack/neutron/commit/55c8173f64e5b2a184eb7e51556a72ec641433a1
Submitter: "Zuul (22348)"
Branch: stable/zed

commit 55c8173f64e5b2a184eb7e51556a72ec641433a1
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Fri Nov 11 12:57:05 2022 +0100

    Always create a "router_extra_attributes" register per router

    The table "router_extra_attributes" is a child of "router" table.
    Each register contains extra information that completes the router
    description. When using ML2/OVS mechanism driver, the methods that
    create and populate the "router_extra_attributes" register are always
    called from the L3 DVR, L3 HA and availability zones extensions.

    When using ML2/OVN, those extensions are not loaded and therefore the
    "router_extra_attributes" register is not created.

    Despite this register is currently not used in ML2/OVN (it will be in
    future features), there are some project expecting the
    "router_extra_attributes" register to be always created (for example,
    neutron-dynamic-routing [1]).

    This patch enforces the child register creating always when a router is
    created. This register is populated with the default values. This new
    register does not affect any current operation related to ML2/OVN nor
    ML2/OVS.

    There is a 1:1 relationship between "routers" and
    "router_extra_attributes". The child register is deleted by the database
    engine when the "routers" register is deleted (ondelete="CASCADE").

    [1]https://review.opendev.org/c/openstack/neutron-dynamic-routing/+/863713

    Closes-Bug: #1995974
    Change-Id: Ic546e40513402fa101c9687acce382cd6b84356c
    (cherry picked from commit 2081910d6d942d49d96297884a932ff93acb8759)

tags: added: in-stable-zed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/wallaby)

Reviewed: https://review.opendev.org/c/openstack/neutron/+/865412
Committed: https://opendev.org/openstack/neutron/commit/dd8a703d47e63afad905bf38ec2d2e1f963ae9b7
Submitter: "Zuul (22348)"
Branch: stable/wallaby

commit dd8a703d47e63afad905bf38ec2d2e1f963ae9b7
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Fri Nov 11 12:57:05 2022 +0100

    Always create a "router_extra_attributes" register per router

    The table "router_extra_attributes" is a child of "router" table.
    Each register contains extra information that completes the router
    description. When using ML2/OVS mechanism driver, the methods that
    create and populate the "router_extra_attributes" register are always
    called from the L3 DVR, L3 HA and availability zones extensions.

    When using ML2/OVN, those extensions are not loaded and therefore the
    "router_extra_attributes" register is not created.

    Despite this register is currently not used in ML2/OVN (it will be in
    future features), there are some project expecting the
    "router_extra_attributes" register to be always created (for example,
    neutron-dynamic-routing [1]).

    This patch enforces the child register creating always when a router is
    created. This register is populated with the default values. This new
    register does not affect any current operation related to ML2/OVN nor
    ML2/OVS.

    There is a 1:1 relationship between "routers" and
    "router_extra_attributes". The child register is deleted by the database
    engine when the "routers" register is deleted (ondelete="CASCADE").

    [1]https://review.opendev.org/c/openstack/neutron-dynamic-routing/+/863713

    Conflicts:
        neutron/objects/router.py
        neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/maintenance.py
        neutron/tests/unit/objects/test_router.py
        neutron/db/availability_zone/router.py
        neutron/db/l3_db.py
        neutron/db/l3_attrs_db.py
        neutron/db/l3_dvr_db.py
        neutron/tests/unit/db/test_l3_db.py
        neutron/tests/unit/objects/test_router.py

    Closes-Bug: #1995974
    Change-Id: Ic546e40513402fa101c9687acce382cd6b84356c
    (cherry picked from commit 2081910d6d942d49d96297884a932ff93acb8759)
    (cherry picked from commit 3874a1ed9a3b7262ef41fe57fdd1237e61a40d44)
    (cherry picked from commit 6c36bada0583aa28b8f4ab161f9e9a793ec7c525)

tags: added: in-stable-wallaby
tags: added: in-stable-yoga
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/yoga)

Reviewed: https://review.opendev.org/c/openstack/neutron/+/865387
Committed: https://opendev.org/openstack/neutron/commit/3874a1ed9a3b7262ef41fe57fdd1237e61a40d44
Submitter: "Zuul (22348)"
Branch: stable/yoga

commit 3874a1ed9a3b7262ef41fe57fdd1237e61a40d44
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Fri Nov 11 12:57:05 2022 +0100

    Always create a "router_extra_attributes" register per router

    The table "router_extra_attributes" is a child of "router" table.
    Each register contains extra information that completes the router
    description. When using ML2/OVS mechanism driver, the methods that
    create and populate the "router_extra_attributes" register are always
    called from the L3 DVR, L3 HA and availability zones extensions.

    When using ML2/OVN, those extensions are not loaded and therefore the
    "router_extra_attributes" register is not created.

    Despite this register is currently not used in ML2/OVN (it will be in
    future features), there are some project expecting the
    "router_extra_attributes" register to be always created (for example,
    neutron-dynamic-routing [1]).

    This patch enforces the child register creating always when a router is
    created. This register is populated with the default values. This new
    register does not affect any current operation related to ML2/OVN nor
    ML2/OVS.

    There is a 1:1 relationship between "routers" and
    "router_extra_attributes". The child register is deleted by the database
    engine when the "routers" register is deleted (ondelete="CASCADE").

    [1]https://review.opendev.org/c/openstack/neutron-dynamic-routing/+/863713

    Conflicts:
        neutron/objects/router.py
        neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/maintenance.py
        neutron/tests/unit/objects/test_router.py

    Closes-Bug: #1995974
    Change-Id: Ic546e40513402fa101c9687acce382cd6b84356c
    (cherry picked from commit 2081910d6d942d49d96297884a932ff93acb8759)

tags: added: in-stable-xena
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/xena)

Reviewed: https://review.opendev.org/c/openstack/neutron/+/865389
Committed: https://opendev.org/openstack/neutron/commit/6c36bada0583aa28b8f4ab161f9e9a793ec7c525
Submitter: "Zuul (22348)"
Branch: stable/xena

commit 6c36bada0583aa28b8f4ab161f9e9a793ec7c525
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Fri Nov 11 12:57:05 2022 +0100

    Always create a "router_extra_attributes" register per router

    The table "router_extra_attributes" is a child of "router" table.
    Each register contains extra information that completes the router
    description. When using ML2/OVS mechanism driver, the methods that
    create and populate the "router_extra_attributes" register are always
    called from the L3 DVR, L3 HA and availability zones extensions.

    When using ML2/OVN, those extensions are not loaded and therefore the
    "router_extra_attributes" register is not created.

    Despite this register is currently not used in ML2/OVN (it will be in
    future features), there are some project expecting the
    "router_extra_attributes" register to be always created (for example,
    neutron-dynamic-routing [1]).

    This patch enforces the child register creating always when a router is
    created. This register is populated with the default values. This new
    register does not affect any current operation related to ML2/OVN nor
    ML2/OVS.

    There is a 1:1 relationship between "routers" and
    "router_extra_attributes". The child register is deleted by the database
    engine when the "routers" register is deleted (ondelete="CASCADE").

    [1]https://review.opendev.org/c/openstack/neutron-dynamic-routing/+/863713

    Conflicts:
        neutron/objects/router.py
        neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/maintenance.py
        neutron/tests/unit/objects/test_router.py
        neutron/db/l3_db.py
        neutron/tests/unit/db/test_l3_db.py
        neutron/tests/unit/objects/test_router.py

    Closes-Bug: #1995974
    Change-Id: Ic546e40513402fa101c9687acce382cd6b84356c
    (cherry picked from commit 2081910d6d942d49d96297884a932ff93acb8759)
    (cherry picked from commit 3874a1ed9a3b7262ef41fe57fdd1237e61a40d44)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 19.5.0

This issue was fixed in the openstack/neutron 19.5.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 22.0.0.0rc1

This issue was fixed in the openstack/neutron 22.0.0.0rc1 release candidate.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 20.3.0

This issue was fixed in the openstack/neutron 20.3.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 21.1.0

This issue was fixed in the openstack/neutron 21.1.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron wallaby-eom

This issue was fixed in the openstack/neutron wallaby-eom release.

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

Other bug subscribers

Remote bug watches

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