Comment 0 for bug 1611852

Richard Theis (rtheis) wrote :

There is a timing window between create and delete port with respect to address sets. That is, deleting a port will result in its IP address being removed from its associated address sets. However, another port could be created at the same time taking over the IP address of the recently delete port. Depending on the sequence of events, the associated address sets may not contain the new ports IP address.

I was able to recreate this problem by adding a 15 second sleep in networking-ovn ML2 driver delete_port_postcommit() method.

$ openstack port create --network private --fixed-ip ip-address=10.0.0.4 port1

$ ovn-nbctl show
    switch 45ba600a-fdf2-447f-961b-f19834f78539 (neutron-9d82f010-4021-48b7-b939-5ef5d3647221)
        port e5a9abc7-537e-425b-b138-56d02630b95f
            addresses: ["fa:16:3e:76:1c:a8 10.0.0.1"]
        port 99e4526a-c711-482a-99a4-bf59451496d9
            addresses: ["fa:16:3e:20:c1:66 fd4f:1747:ed80::1"]
        port ea898f42-6c5d-4f8b-a848-dfb9279be2ec
            addresses: ["fa:16:3e:78:9e:c2 10.0.0.4 fd4f:1747:ed80:0:f816:3eff:fe78:9ec2"]

...

$ ovn-nbctl list address_set
_uuid : 9e09ff9e-9bc7-49dc-8837-71808182a403
addresses : ["10.0.0.4"]
external_ids : {"neutron:security_group_name"=default}
name : "as_ip4_a420da8b_ea8b_46d4_891e_5441a87a261d"

...

# Run port create and delete at the same time.
$ openstack port delete port1
$ openstack port create --network private --fixed-ip ip-address=10.0.0.4 port2

$ ovn-nbctl show
    switch 45ba600a-fdf2-447f-961b-f19834f78539 (neutron-9d82f010-4021-48b7-b939-5ef5d3647221)
        port e5a9abc7-537e-425b-b138-56d02630b95f
            addresses: ["fa:16:3e:76:1c:a8 10.0.0.1"]
        port 99e4526a-c711-482a-99a4-bf59451496d9
            addresses: ["fa:16:3e:20:c1:66 fd4f:1747:ed80::1"]
        port 23ce3eda-5e5e-4aa7-acad-3c5156135129
            addresses: ["fa:16:3e:00:e8:83 10.0.0.4 fd4f:1747:ed80:0:f816:3eff:fe00:e883"]

...

$ ovn-nbctl list address_set
_uuid : 9e09ff9e-9bc7-49dc-8837-71808182a403
addresses : []
external_ids : {"neutron:security_group_name"=default}
name : "as_ip4_a420da8b_ea8b_46d4_891e_5441a87a261d"

...