IP address inventory handling for routed net does not work for ip_allocation=deferrred

Bug #1916276 reported by Balazs Gibizer on 2021-02-19
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Medium
Lajos Katona

Bug Description

Reproduction:
0) have a devstack on recent master and turn on the segments service_plugin in neutron.conf

1) create a provider net

  $ openstack network create net3 --share --provider-network-type vlan --provider-physical-network physnet0 --provider-segment 103

2) get the segmentation id

  $ openstack network segment list --network net3

3) use the segmentation id to create a subnet

  $ openstack subnet create subnet3 --network net3 --subnet-range 10.0.7.0/24 --network-segment 8313239b-eddd-4a38-86d6-5c50ffee8b52

4) create a port with ip_allocation=deferred (default

  $ openstack port create --net net3 port1

At this point no IP is allocated for the port so the IP inventory is placement expected to be the same as at #3)

5) bound the port like nova does

  $ openstack port set port1 --device-owner compute:nova --host aio

this assigns an IP address to the port.

Expected:
The IP inventory on the segment 8313239b-eddd-4a38-86d6-5c50ffee8b52 is updated

  $ openstack resource provider inventory list 8313239b-eddd-4a38-86d6-5c50ffee8b52

Actual:
The IP inventory is not updated.

Triage:
There seems to be logic error in [1]. It gets the segment_id of the original port (before the binding) but that code looks for the fixed_ips in the port founds nothing and therefore returns no segment_id. Then the code simply returns from [1]. However the new port (after the binding) has segment_id so there is a need for inventory recalculation.

See the reproduction with command printouts in [2]

[1]https://opendev.org/openstack/neutron/src/branch/master/neutron/services/segments/plugin.py#L446-L450
[2]http://paste.openstack.org/show/802844/

Changed in neutron:
status: New → Confirmed
importance: Undecided → Medium
Balazs Gibizer (balazs-gibizer) wrote :

I think the tempest test[1] just reproduced the problem reported above.

[1] https://review.opendev.org/c/openstack/tempest/+/665155

Changed in neutron:
assignee: nobody → Lajos Katona (lajos-katona)
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers