The subnet field in metdadata port is incorrectly updated in some cases

Bug #1737865 reported by Dong Jun
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
networking-ovn
New
Undecided
Unassigned

Bug Description

After the following steps, the subnet field in the metdadata port is incorrectly updated, it will contain all subnets regardless of the subnet supports dhcp or not.

1st: Create two subnets in same network, one with enable_dhcp=True and the other with enable_dhcp=False.[1]
2nd: Update the first subnet, e.g. updating subnet name
   openstack subnet set --name subnet2-new 639659e1-d11e-445e-8fc0-3f946e71daee

Then metadata port contains both of the two subnets, that's incorrect.[2]

Seems there are two issues, one is enable_dhcp=[1] is missing in filter and the other is we did not clear the subnets which are disabled.

Issue 1: https://github.com/openstack/networking-ovn/blob/2ccd34397683c0deab4a76d9eba2d61cc8187da8/networking_ovn/common/ovn_client.py#L1158
Issue 2: https://github.com/openstack/networking-ovn/blob/2ccd34397683c0deab4a76d9eba2d61cc8187da8/networking_ovn/common/ovn_client.py#L1169

[1]
ovn lsp column:
56c514b1-427d-45a3-b4e1-35fb322396a4 ["fa:16:3e:ad:04:00 10.0.0.66"] [] [] [] true {"neutron:cidrs"="10.0.0.66/26", "neutron:device_id"="", "neutron:port_name"="", "neutron:project_id"="0134078dd4e54009bc64cac8dc0fa733"} "790b1d9c-4926-4a95-9451-528f17d5c1da" {requested-chassis=""}

stack@c3:~/networking-ovn$ openstack subnet show 639659e1-d11e-445e-8fc0-3f946e71daee
+-------------------------+--------------------------------------+
| Field | Value |
+-------------------------+--------------------------------------+
| cidr | 10.0.0.64/26 |
| enable_dhcp | True |
| gateway_ip | 10.0.0.65 |
| network_id | 69e1e4d1-5576-4cbf-8f01-8873122c5600 |
| project_id | 0134078dd4e54009bc64cac8dc0fa733 |
...
+-------------------------+--------------------------------------+

stack@c3:~/networking-ovn$ openstack subnet show e31f1af1-0e88-4194-bd58-81d5b5a6cba2
+-------------------------+--------------------------------------+
| Field | Value |
+-------------------------+--------------------------------------+
| cidr | 10.0.0.192/26 |
| enable_dhcp | False |
| gateway_ip | 10.0.0.193 |
| network_id | 69e1e4d1-5576-4cbf-8f01-8873122c5600 |
...
+-------------------------+--------------------------------------+

stack@c3:~/networking-ovn$ openstack port show 790b1d9c-4926-4a95-9451-528f17d5c1da
+-----------------------+--------------------------------------------------------------------------+
| Field | Value |
+-----------------------+--------------------------------------------------------------------------+
| device_owner | network:dhcp |
| fixed_ips | ip_address='10.0.0.66', subnet_id='639659e1-d11e-445e-8fc0-3f946e71daee' |
| id | 790b1d9c-4926-4a95-9451-528f17d5c1da |
| network_id | 69e1e4d1-5576-4cbf-8f01-8873122c5600 |
...
+-----------------------+--------------------------------------------------------------------------+

[2]
stack@c3:~/networking-ovn$ openstack port show 790b1d9c-4926-4a95-9451-528f17d5c1da
+-----------------------+---------------------------------------------------------------------------+
| Field | Value |
+-----------------------+---------------------------------------------------------------------------+
| admin_state_up | UP |
| device_owner | network:dhcp |
| fixed_ips | ip_address='10.0.0.194', subnet_id='e31f1af1-0e88-4194-bd58-81d5b5a6cba2' |
| | ip_address='10.0.0.66', subnet_id='639659e1-d11e-445e-8fc0-3f946e71daee' |
| id | 790b1d9c-4926-4a95-9451-528f17d5c1da |
| network_id | 69e1e4d1-5576-4cbf-8f01-8873122c5600 |
...
+-----------------------+---------------------------------------------------------------------------+

Dong Jun (dongj)
description: updated
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.