[IPAM] During port bulk creation, if a "fixed_ip" request is incorrect, the previous IPAM allocations generated are not deleted

Bug #2039550 reported by Rodolfo Alonso
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Medium
Rodolfo Alonso

Bug Description

Related bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2244365

During the port bulk creation, before the port DB registers are created, there is a method that pre-creates the port MAC address and the IPAM allocations [1]. If one of the requested "fixed_ips" is incorrect (for example, the IP address is out of the subnet CIDR), the method will raise an exception. However, the IPAM allocations created previously will remain in the DB.

Steps:
$ openstack create network net1
$ openstack subnet create --subnet-range 10.0.50.0/24 --network net1 snet1
$ OS_TOKEN=`openstack token issue | grep "| id" | tr -s " " | cut -f4 -d" "`
$ curl -H "X-Auth-Token:$OS_TOKEN" -X POST http://192.168.10.100:9696/networking/v2.0/ports
    -d '{"ports": [
      {"network_id": <net_id>,
       "fixed_ips": [{"subnet_id": <subnet_id>, "ip_address": "10.0.50.10"}]},
      {"network_id": <net_id>,
       "fixed_ips": [{"subnet_id": <subnet_id>, "ip_address": "10.0.51.20"}]}]}'

Note that the second IP address 10.0.51.20 is not in the subnet CIDR 10.0.50.0/24. The IPAM allocation for 10.0.50.10 (the first request), will remain in the DB.

[1]https://github.com/openstack/neutron/blob/2bc9c3833627da0dfdf901e15f78b9be397014e0/neutron/plugins/ml2/plugin.py#L1621-L1660

Changed in neutron:
assignee: nobody → Rodolfo Alonso (rodolfo-alonso-hernandez)
importance: Undecided → Medium
Changed in neutron:
status: New → Confirmed
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/+/898549

Changed in neutron:
status: Confirmed → In Progress
Revision history for this message
Rodolfo Alonso (rodolfo-alonso-hernandez) wrote :

The fix for this bug should be backported.

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

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

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

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

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

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

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

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

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

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

commit 71a7abb498fded6d8d60453074efdef9657f416e
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Sat Oct 14 18:37:43 2023 +0000

    Remove any IPAM allocation if port bulk creation fails

    During the port bulk creation, if an IPAM allocation fails (for
    example, if the IP address is outside of the subnet CIDR), the
    other IPAM allocations already created are deleted before raising
    the exception.

    Closes-Bug: #2039550
    Change-Id: I7fd6e38016d099c03f80874bfa1fb8bdaff8bd2c

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

Reviewed: https://review.opendev.org/c/openstack/neutron/+/898714
Committed: https://opendev.org/openstack/neutron/commit/59e3b22d140ea5cd96c3d72fedd4813105c53bb8
Submitter: "Zuul (22348)"
Branch: stable/2023.2

commit 59e3b22d140ea5cd96c3d72fedd4813105c53bb8
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Sat Oct 14 18:37:43 2023 +0000

    Remove any IPAM allocation if port bulk creation fails

    During the port bulk creation, if an IPAM allocation fails (for
    example, if the IP address is outside of the subnet CIDR), the
    other IPAM allocations already created are deleted before raising
    the exception.

    Closes-Bug: #2039550
    Change-Id: I7fd6e38016d099c03f80874bfa1fb8bdaff8bd2c
    (cherry picked from commit 71a7abb498fded6d8d60453074efdef9657f416e)

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

Reviewed: https://review.opendev.org/c/openstack/neutron/+/898716
Committed: https://opendev.org/openstack/neutron/commit/717eb389917ff6500ee2e4d36006f03e092a9e7d
Submitter: "Zuul (22348)"
Branch: stable/zed

commit 717eb389917ff6500ee2e4d36006f03e092a9e7d
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Sat Oct 14 18:37:43 2023 +0000

    Remove any IPAM allocation if port bulk creation fails

    During the port bulk creation, if an IPAM allocation fails (for
    example, if the IP address is outside of the subnet CIDR), the
    other IPAM allocations already created are deleted before raising
    the exception.

    Conflicts:
      neutron/tests/unit/plugins/ml2/test_plugin.py

    Closes-Bug: #2039550
    Change-Id: I7fd6e38016d099c03f80874bfa1fb8bdaff8bd2c
    (cherry picked from commit 71a7abb498fded6d8d60453074efdef9657f416e)
    (cherry picked from commit a4c03671f2b8784cb6bec227ddbd56a16fffbcf1)

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

commit df5cb326ed1a3eb9b6ec10ed3d375551d6c36cb9
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Sat Oct 14 18:37:43 2023 +0000

    Remove any IPAM allocation if port bulk creation fails

    During the port bulk creation, if an IPAM allocation fails (for
    example, if the IP address is outside of the subnet CIDR), the
    other IPAM allocations already created are deleted before raising
    the exception.

    Conflicts:
      neutron/tests/unit/plugins/ml2/test_plugin.py

    Closes-Bug: #2039550
    Change-Id: I7fd6e38016d099c03f80874bfa1fb8bdaff8bd2c
    (cherry picked from commit 71a7abb498fded6d8d60453074efdef9657f416e)
    (cherry picked from commit a4c03671f2b8784cb6bec227ddbd56a16fffbcf1)

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/+/898718
Committed: https://opendev.org/openstack/neutron/commit/df23a8394197949d17d79edcbe49e25ce542bd11
Submitter: "Zuul (22348)"
Branch: stable/xena

commit df23a8394197949d17d79edcbe49e25ce542bd11
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Sat Oct 14 18:37:43 2023 +0000

    Remove any IPAM allocation if port bulk creation fails

    During the port bulk creation, if an IPAM allocation fails (for
    example, if the IP address is outside of the subnet CIDR), the
    other IPAM allocations already created are deleted before raising
    the exception.

    Conflicts:
      neutron/tests/unit/plugins/ml2/test_plugin.py

    Closes-Bug: #2039550
    Change-Id: I7fd6e38016d099c03f80874bfa1fb8bdaff8bd2c
    (cherry picked from commit 71a7abb498fded6d8d60453074efdef9657f416e)
    (cherry picked from commit a4c03671f2b8784cb6bec227ddbd56a16fffbcf1)

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

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

commit a93d90f25ef5fed9a74962bcc5d128735f8d854d
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Sat Oct 14 18:37:43 2023 +0000

    Remove any IPAM allocation if port bulk creation fails

    During the port bulk creation, if an IPAM allocation fails (for
    example, if the IP address is outside of the subnet CIDR), the
    other IPAM allocations already created are deleted before raising
    the exception.

    Conflicts:
      neutron/tests/unit/plugins/ml2/test_plugin.py

    Closes-Bug: #2039550
    Change-Id: I7fd6e38016d099c03f80874bfa1fb8bdaff8bd2c
    (cherry picked from commit 71a7abb498fded6d8d60453074efdef9657f416e)
    (cherry picked from commit a4c03671f2b8784cb6bec227ddbd56a16fffbcf1)

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

Reviewed: https://review.opendev.org/c/openstack/neutron/+/898715
Committed: https://opendev.org/openstack/neutron/commit/a4c03671f2b8784cb6bec227ddbd56a16fffbcf1
Submitter: "Zuul (22348)"
Branch: stable/2023.1

commit a4c03671f2b8784cb6bec227ddbd56a16fffbcf1
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Sat Oct 14 18:37:43 2023 +0000

    Remove any IPAM allocation if port bulk creation fails

    During the port bulk creation, if an IPAM allocation fails (for
    example, if the IP address is outside of the subnet CIDR), the
    other IPAM allocations already created are deleted before raising
    the exception.

    Conflicts:
      neutron/tests/unit/plugins/ml2/test_plugin.py

    Closes-Bug: #2039550
    Change-Id: I7fd6e38016d099c03f80874bfa1fb8bdaff8bd2c
    (cherry picked from commit 71a7abb498fded6d8d60453074efdef9657f416e)

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

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

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

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

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

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

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

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

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

This issue was fixed in the openstack/neutron 24.0.0.0b1 development milestone.

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.

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

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

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.