The atteched devstack configuration `local.conf` can be used to reproduce this issue.
In networking-baremetal CI we are seeing an issue where the DHCP agent does not create a namespace for subnets on a routed provider network. No DHCP namespace is created because this test[1] `if (any(s for s in network.subnets if s.enable_dhcp)` returns false.
The OVS agent does have the correct configuration, with mappings to the physical_network "mynetwork" on bridge "brbm".
$ openstack network agent show ef7ca33a-de9c-4a2b-9af5-e1c9cb029a25 -f yaml
admin_state_up: true
agent_type: Open vSwitch agent
alive: true
availability_zone: null
binary: neutron-openvswitch-agent
configuration:
arp_responder_enabled: false
baremetal_smartnic: false
bridge_mappings:
mynetwork: brbm
public: br-ex
But looking in the database, there are only `segment host mappings` for baremetal nodes.
mysql> select * from segmenthostmappings;
+--------------------------------------+--------------------------------------+
| segment_id | host |
+--------------------------------------+--------------------------------------+
| 712e8a82-a5f9-4506-9520-fc5b4b01529e | 30e70889-d50c-42a8-8776-f5e8cdce3609 |
| 712e8a82-a5f9-4506-9520-fc5b4b01529e | a3930bb2-a742-44f8-954e-49be373477db |
| 712e8a82-a5f9-4506-9520-fc5b4b01529e | cbb3f623-f300-4dd3-ab09-c05b1e9b9a75 |
| ede8201d-0766-4a18-9df0-1b6292f99592 | 30e70889-d50c-42a8-8776-f5e8cdce3609 |
| ede8201d-0766-4a18-9df0-1b6292f99592 | a3930bb2-a742-44f8-954e-49be373477db |
| ede8201d-0766-4a18-9df0-1b6292f99592 | cbb3f623-f300-4dd3-ab09-c05b1e9b9a75 |
+--------------------------------------+--------------------------------------+
6 rows in set (0.00 sec)
If I manually stop the OVS agent service, manually delete the agent and then restart the OVS agent the agent is re-created and mappings are created.
stack@devstack:~/devstack$ sudo systemctl stop <email address hidden>
stack@devstack:~/devstack$ openstack network agent delete 3921f433-b2f1-4c8f-90d2-deaad6bb5814
stack@devstack:~/devstack$ sudo systemctl start <email address hidden>
mysql> select * from segmenthostmappings;
+--------------------------------------+--------------------------------------+
| segment_id | host |
+--------------------------------------+--------------------------------------+
| 712e8a82-a5f9-4506-9520-fc5b4b01529e | 30e70889-d50c-42a8-8776-f5e8cdce3609 |
| 712e8a82-a5f9-4506-9520-fc5b4b01529e | a3930bb2-a742-44f8-954e-49be373477db |
| 712e8a82-a5f9-4506-9520-fc5b4b01529e | cbb3f623-f300-4dd3-ab09-c05b1e9b9a75 |
| 712e8a82-a5f9-4506-9520-fc5b4b01529e | devstack |
| e0673f45-e9b4-4672-874f-e2eb65d74d70 | devstack |
| e2c8c728-9e55-4047-b56f-701375887da9 | devstack |
| ede8201d-0766-4a18-9df0-1b6292f99592 | 30e70889-d50c-42a8-8776-f5e8cdce3609 |
| ede8201d-0766-4a18-9df0-1b6292f99592 | a3930bb2-a742-44f8-954e-49be373477db |
| ede8201d-0766-4a18-9df0-1b6292f99592 | cbb3f623-f300-4dd3-ab09-c05b1e9b9a75 |
| ede8201d-0766-4a18-9df0-1b6292f99592 | devstack |
+--------------------------------------+--------------------------------------+
To get the DHCP namespace up and running the DHCP agent service must be restarted as well.
stack@devstack:~/devstack$ ip netns list
qdhcp-6fd5f856-bcf6-4821-a85c-18139e934061 (id: 2)
qrouter-ea62445b-ea09-4a2d-88e9-87bede21d6c6 (id: 1)
qdhcp-4b9aae0e-482d-402f-a7c4-2acaad2f3620 (id: 0)
stack@devstack:~/devstack$ sudo systemctl restart <email address hidden>
stack@devstack:~/devstack$ ip netns list
qdhcp-b435b564-ce44-4fc1-bec2-2a4ccb27346f (id: 3) <-- The DHCP was created.
qdhcp-6fd5f856-bcf6-4821-a85c-18139e934061 (id: 2)
qrouter-ea62445b-ea09-4a2d-88e9-87bede21d6c6 (id: 1)
qdhcp-4b9aae0e-482d-402f-a7c4-2acaad2f3620 (id: 0)
In this CI job[2] with patch[3] we can see that the host is added with no segments:
May 19 17:47:34.266428 ubuntu-focal-ovh-bhs1-0029706921 neutron-server[84188]: DEBUG neutron.services.segments.db [None req-ac845447-48ed-4c73-85c9-347133259602 None None] Segments set() mapped to the host ubuntu-focal-ovh-bhs1-0029706921 {{(pid=84188) update_segment_host_mapping /opt/stack/neutron/neutron/services/segments/db.py:237}}
[1] https://opendev.org/openstack/neutron/src/branch/master/neutron/agent/dhcp/agent.py#L403
[2] https://review.opendev.org/c/openstack/networking-baremetal/+/842578
[3] https://review.opendev.org/842576
It seems the issue is that new segment mappings are not created when new networks are created after the agent was created. If I stop the OVS agent, delete the agent, and restart it I see segment host mappings for the existing networks. But when I add a new network the segment host mappings are not updated.
stack@devstack:~$ sudo systemctl stop <email address hidden> 389b-4cf2- 945c-e16c80cc43 56 physical- network mynetwork --provider- network- type vlan --provider-segment 140 new-seg-net ------- ------- ------- +------ ------- ------- ------- ------- ----+ ------- ------- ------- +------ ------- ------- ------- ------- ----+ zone_hints | | 24T10:26: 48Z | d716-478f- 8ccc-9ac1de8711 36 | enabled | True | f91da365388e336 eb | network_ type | vlan | physical_ network | mynetwork | segmentation_ id | 140 | 24T10:26: 48Z | ------- ------- ------- +------ ------- ------- ------- ------- ----+ ------- ------- ------- ------- ----+-- ----+-- ------- ------- ------- ------- ------- -+----- ------- --+---- -----+- ------- ------- ---...
stack@devstack:~$ openstack network agent delete 4309835f-
stack@devstack:~$ sudo systemctl start <email address hidden>
stack@devstack:~$ openstack network create --share --provider-
+------
| Field | Value |
+------
| admin_state_up | UP |
| availability_
| availability_zones | |
| created_at | 2022-05-
| description | |
| dns_domain | None |
| id | d290cc37-
| ipv4_address_scope | None |
| ipv6_address_scope | None |
| is_default | None |
| is_vlan_transparent | None |
| mtu | 1500 |
| name | new-seg-net |
| port_security_
| project_id | b3f72ae335f7401
| provider:
| provider:
| provider:
| qos_policy_id | None |
| revision_number | 1 |
| router:external | Internal |
| segments | None |
| shared | True |
| status | ACTIVE |
| subnets | |
| tags | |
| updated_at | 2022-05-
+------
stack@devstack:~$ openstack network segment list --long --fit
+------