ML2 - Network Context, not possible to see original/current segments

Bug #1967742 reported by Harald Jensås
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Medium
Miro Tomaska

Bug Description

When ML2 driver receive NetworkContext after adding network segment with:

 openstack network segment create \
  --network e686a356-58d7-4cf0-bdf9-e720d9925ac0 \
  --physical-network net3 \
  --network-type vlan \
  --segment 300 provision-net3

In `update_network_postcommit`, context.current and context.original both include all segments:

context.current:

{'id': 'e686a356-58d7-4cf0-bdf9-e720d9925ac0',
 'name': 'routed_provider_net',
 'segments': [
   {'provider:network_type': 'vlan',
    'provider:physical_network': 'net1',
    'provider:segmentation_id': 100},
   {'provider:network_type': 'vlan',
    'provider:physical_network': 'net2',
    'provider:segmentation_id': 200},
   {'provider:network_type': 'vlan',
    'provider:physical_network': 'net3',
    'provider:segmentation_id': 300}]}

context.original:

{'id': 'e686a356-58d7-4cf0-bdf9-e720d9925ac0',
 'name': 'routed_provider_net',
 'segments': [
   {'provider:network_type': 'vlan',
    'provider:physical_network': 'net1',
    'provider:segmentation_id': 100},
   {'provider:network_type': 'vlan',
    'provider:physical_network': 'net2',
    'provider:segmentation_id': 200},
   {'provider:network_type': 'vlan',
    'provider:physical_network': 'net3',
    'provi der:segmentation_id': 300}]}

Expected results:

context.orignial should not include the new segment on physical_network: 'net3'.

Since both current and original include all segments it is not possible for ML2 plugins to know which VLAN to add on managed devices.

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

Hello:

I think this is because we are passing the same object in "NetworkContext.network" and "original_network.network" [1].

The method "_notify_mechanism_driver_for_segment_change" argument list should contain the related segment and the event type (deletion or creation). With this information the "NetworkContext" can be populated correctly.

Regards.

[1]https://github.com/openstack/neutron/blob/3615cd85a4cc6aeecf7f066c4eb21c3cdca71d4c/neutron/plugins/ml2/plugin.py#L2484-L2486

Revision history for this message
Lucas Alvares Gomes (lucasagomes) wrote :

Marking the bug as confirmed based on Rodolfo's troubleshooting of the problem

Changed in neutron:
status: New → Confirmed
importance: Undecided → Medium
Miro Tomaska (mtomaska)
Changed in neutron:
assignee: nobody → Miro Tomaska (mtomaska)
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/+/840146

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

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

commit d1fe14d366e501869addff17e851ac03a599adca
Author: Miro Tomaska <email address hidden>
Date: Fri May 6 13:42:11 2022 -0500

    Notify mech drivers with original and modified network.

    Include original and modified network when notifying mechanism drivers in PRECOMMIT event. PRECOMMIT_CREATE modified network includes new segment, while original does not. Exact opposite for PRECOMMIT_DELETE

    Closes-Bug: #1967742
    Change-Id: I364fc7981458374ed25eb8837d1ed3afff046b95

Changed in neutron:
status: In Progress → Fix Released
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/+/844203

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/+/844204

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/+/844205

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

Reviewed: https://review.opendev.org/c/openstack/neutron/+/844203
Committed: https://opendev.org/openstack/neutron/commit/9a8de0cde7003544ecf998a08a293af64f95009c
Submitter: "Zuul (22348)"
Branch: stable/yoga

commit 9a8de0cde7003544ecf998a08a293af64f95009c
Author: Miro Tomaska <email address hidden>
Date: Fri May 6 13:42:11 2022 -0500

    Notify mech drivers with original and modified network.

    Include original and modified network when notifying mechanism drivers in PRECOMMIT event. PRECOMMIT_CREATE modified network includes new segment, while original does not. Exact opposite for PRECOMMIT_DELETE

    Closes-Bug: #1967742
    Change-Id: I364fc7981458374ed25eb8837d1ed3afff046b95
    (cherry picked from commit d1fe14d366e501869addff17e851ac03a599adca)

tags: added: in-stable-yoga
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/+/844204
Committed: https://opendev.org/openstack/neutron/commit/7bf8fb6841d95a0ffa32eb4106a6427a14f94017
Submitter: "Zuul (22348)"
Branch: stable/xena

commit 7bf8fb6841d95a0ffa32eb4106a6427a14f94017
Author: Miro Tomaska <email address hidden>
Date: Fri May 6 13:42:11 2022 -0500

    Notify mech drivers with original and modified network.

    Include original and modified network when notifying mechanism drivers in PRECOMMIT event. PRECOMMIT_CREATE modified network includes new segment, while original does not. Exact opposite for PRECOMMIT_DELETE

    Closes-Bug: #1967742
    Change-Id: I364fc7981458374ed25eb8837d1ed3afff046b95
    (cherry picked from commit d1fe14d366e501869addff17e851ac03a599adca)

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

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

commit ff0fb30c7c12f2edab8ab05ac285079ea4bd5534
Author: Miro Tomaska <email address hidden>
Date: Fri May 6 13:42:11 2022 -0500

    Notify mech drivers with original and modified network.

    Include original and modified network when notifying mechanism drivers in PRECOMMIT event. PRECOMMIT_CREATE modified network includes new segment, while original does not. Exact opposite for PRECOMMIT_DELETE

    Closes-Bug: #1967742
    Change-Id: I364fc7981458374ed25eb8837d1ed3afff046b95
    (cherry picked from commit d1fe14d366e501869addff17e851ac03a599adca)

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

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

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

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

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

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

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

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

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.