Comment 0 for bug 1737865

Revision history for this message
Dong Jun (dongj) wrote :

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

1.Create two subnets in same network one with enable_dhcp True and the other with enable_dhcp not.[1]
2.Update the first subnet(enable_dhcp True), e.g. 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 we should add enable_dhcp=[1] to filter and the other is we did not clear the subnets disabling.

https://github.com/openstack/networking-ovn/blob/2ccd34397683c0deab4a76d9eba2d61cc8187da8/networking_ovn/common/ovn_client.py#L1158
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 |
...
+-----------------------+---------------------------------------------------------------------------+