create multiple reserved_dhcp_port doesn't work as expected

Bug #1876021 reported by uchenily
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
New
Undecided
Unassigned

Bug Description

I create a subnet 172.30.0.0/24, gateway 172.30.0.254, disabled dhcp, 3 dhcp servers per network.

In order not to occupy addresses like: 172.30.0.1, 172.30.0.2, 172.30.0.3, I want to specify dhcp port address use `reserved_dhcp_port` feature:

root@mgt01:~# openstack port create --network 6a0f68ff-1382-4959-aa22-c52da91177f2 --device reserved_dhcp_port --host mgt04 --fixed-ip subnet=e80b4163-2308-4b3d-afe3-45992e1b652c,ip-address=172.30.0.251 --disable-port-security dhcp-port-1
+-----------------------+-----------------------------------------------------------------------------+
| Field | Value |
+-----------------------+-----------------------------------------------------------------------------+
| admin_state_up | UP |
| allowed_address_pairs | |
| binding_host_id | mgt04 |
| binding_profile | |
| binding_vif_details | datapath_type='system', ovs_hybrid_plug='True', port_filter='True' |
| binding_vif_type | ovs |
| binding_vnic_type | normal |
| created_at | 2020-04-30T02:46:33Z |
| data_plane_status | None |
| description | |
| device_id | reserved_dhcp_port |
| device_owner | |
| dns_assignment | None |
| dns_domain | None |
| dns_name | None |
| extra_dhcp_opts | |
| fixed_ips | ip_address='172.30.0.251', subnet_id='e80b4163-2308-4b3d-afe3-45992e1b652c' |
| id | e3ed1ba5-7cd8-4464-9bad-c71aadb85ff9 |
| mac_address | fa:16:3e:fc:0b:ac |
| name | dhcp-port-1 |
| network_id | 6a0f68ff-1382-4959-aa22-c52da91177f2 |
| port_security_enabled | False |
| project_id | 0606e9bf4e9c4334b6cb9a5012c60fb8 |
| qos_policy_id | None |
| revision_number | 1 |
| security_group_ids | |
| status | DOWN |
| tags | |
| trunk_details | None |
| updated_at | 2020-04-30T02:46:33Z |
+-----------------------+-----------------------------------------------------------------------------+
root@mgt01:~# openstack port create --network 6a0f68ff-1382-4959-aa22-c52da91177f2 --device reserved_dhcp_port --host mgt05 --fixed-ip subnet=e80b4163-2308-4b3d-afe3-45992e1b652c,ip-address=172.30.0.252 --disable-port-security dhcp-port-2
+-----------------------+-----------------------------------------------------------------------------+
| Field | Value |
+-----------------------+-----------------------------------------------------------------------------+
| admin_state_up | UP |
| allowed_address_pairs | |
| binding_host_id | mgt05 |
| binding_profile | |
| binding_vif_details | datapath_type='system', ovs_hybrid_plug='True', port_filter='True' |
| binding_vif_type | ovs |
| binding_vnic_type | normal |
| created_at | 2020-04-30T02:46:52Z |
| data_plane_status | None |
| description | |
| device_id | reserved_dhcp_port |
| device_owner | |
| dns_assignment | None |
| dns_domain | None |
| dns_name | None |
| extra_dhcp_opts | |
| fixed_ips | ip_address='172.30.0.252', subnet_id='e80b4163-2308-4b3d-afe3-45992e1b652c' |
| id | e5684fc8-5a97-491a-aeda-f9ba18c7cabb |
| mac_address | fa:16:3e:b6:52:63 |
| name | dhcp-port-2 |
| network_id | 6a0f68ff-1382-4959-aa22-c52da91177f2 |
| port_security_enabled | False |
| project_id | 0606e9bf4e9c4334b6cb9a5012c60fb8 |
| qos_policy_id | None |
| revision_number | 1 |
| security_group_ids | |
| status | DOWN |
| tags | |
| trunk_details | None |
| updated_at | 2020-04-30T02:46:52Z |
+-----------------------+-----------------------------------------------------------------------------+
root@mgt01:~# openstack port create --network 6a0f68ff-1382-4959-aa22-c52da91177f2 --device reserved_dhcp_port --host mgt06 --fixed-ip subnet=e80b4163-2308-4b3d-afe3-45992e1b652c,ip-address=172.30.0.253 --disable-port-security dhcp-port-3
+-----------------------+-----------------------------------------------------------------------------+
| Field | Value |
+-----------------------+-----------------------------------------------------------------------------+
| admin_state_up | UP |
| allowed_address_pairs | |
| binding_host_id | mgt06 |
| binding_profile | |
| binding_vif_details | datapath_type='system', ovs_hybrid_plug='True', port_filter='True' |
| binding_vif_type | ovs |
| binding_vnic_type | normal |
| created_at | 2020-04-30T02:47:14Z |
| data_plane_status | None |
| description | |
| device_id | reserved_dhcp_port |
| device_owner | |
| dns_assignment | None |
| dns_domain | None |
| dns_name | None |
| extra_dhcp_opts | |
| fixed_ips | ip_address='172.30.0.253', subnet_id='e80b4163-2308-4b3d-afe3-45992e1b652c' |
| id | c09af236-2a5e-4da5-92b5-d4d6e193c7a4 |
| mac_address | fa:16:3e:a1:c3:2e |
| name | dhcp-port-3 |
| network_id | 6a0f68ff-1382-4959-aa22-c52da91177f2 |
| port_security_enabled | False |
| project_id | 0606e9bf4e9c4334b6cb9a5012c60fb8 |
| qos_policy_id | None |
| revision_number | 1 |
| security_group_ids | |
| status | DOWN |
| tags | |
| trunk_details | None |
| updated_at | 2020-04-30T02:47:14Z |
+-----------------------+-----------------------------------------------------------------------------+
root@mgt01:~# openstack port list --network 6a0f68ff-1382-4959-aa22-c52da91177f2
+--------------------------------------+-------------+-------------------+-----------------------------------------------------------------------------+--------+
| ID | Name | MAC Address | Fixed IP Addresses | Status |
+--------------------------------------+-------------+-------------------+-----------------------------------------------------------------------------+--------+
| c09af236-2a5e-4da5-92b5-d4d6e193c7a4 | dhcp-port-3 | fa:16:3e:a1:c3:2e | ip_address='172.30.0.253', subnet_id='e80b4163-2308-4b3d-afe3-45992e1b652c' | DOWN |
| e3ed1ba5-7cd8-4464-9bad-c71aadb85ff9 | dhcp-port-1 | fa:16:3e:fc:0b:ac | ip_address='172.30.0.251', subnet_id='e80b4163-2308-4b3d-afe3-45992e1b652c' | DOWN |
| e5684fc8-5a97-491a-aeda-f9ba18c7cabb | dhcp-port-2 | fa:16:3e:b6:52:63 | ip_address='172.30.0.252', subnet_id='e80b4163-2308-4b3d-afe3-45992e1b652c' | DOWN |
+--------------------------------------+-------------+-------------------+-----------------------------------------------------------------------------+--------+
root@mgt01:~# openstack subnet set e80b4163-2308-4b3d-afe3-45992e1b652c --dhcp
root@mgt01:~# openstack port list --network 6a0f68ff-1382-4959-aa22-c52da91177f2
+--------------------------------------+-------------+-------------------+-----------------------------------------------------------------------------+--------+
| ID | Name | MAC Address | Fixed IP Addresses | Status |
+--------------------------------------+-------------+-------------------+-----------------------------------------------------------------------------+--------+
| c09af236-2a5e-4da5-92b5-d4d6e193c7a4 | dhcp-port-3 | fa:16:3e:a1:c3:2e | ip_address='172.30.0.253', subnet_id='e80b4163-2308-4b3d-afe3-45992e1b652c' | ACTIVE |
| e3ed1ba5-7cd8-4464-9bad-c71aadb85ff9 | dhcp-port-1 | fa:16:3e:fc:0b:ac | ip_address='172.30.0.251', subnet_id='e80b4163-2308-4b3d-afe3-45992e1b652c' | DOWN |
| e5684fc8-5a97-491a-aeda-f9ba18c7cabb | dhcp-port-2 | fa:16:3e:b6:52:63 | ip_address='172.30.0.252', subnet_id='e80b4163-2308-4b3d-afe3-45992e1b652c' | DOWN |
+--------------------------------------+-------------+-------------------+-----------------------------------------------------------------------------+--------+

a reserved_dhcp_port became active after enable dhcp, but the other two were still DOWN.

Is it a normal action or undefined one? Can we improve it? Thanks in advance.

Tags: l3-ipam-dhcp
Revision history for this message
uchenily (uchenily) wrote :
Revision history for this message
Oleg Bondarev (obondarev) wrote :

@uchenily, please check how many active dhcp agents are there in your environment.
Also please check how many agents do host the net. It might be the problem on dhcp agents side - please check their logs and copy here in case issues found.

Changed in neutron:
status: New → Incomplete
tags: added: l3-ipam-dhcp
Revision history for this message
uchenily (uchenily) wrote :
Download full text (3.7 KiB)

@Bondarev, I have checked it, all dhcp agent is ok, if I didn't use `reserved_dhcp_port` and enable dhcp directly, 3 dhcp ports will be active.

root@mgt01:~# openstack network agent list --agent-type dhcp
+--------------------------------------+------------+-------+-------------------+-------+-------+--------------------+
| ID | Agent Type | Host | Availability Zone | Alive | State | Binary |
+--------------------------------------+------------+-------+-------------------+-------+-------+--------------------+
| 4e9de69c-57d7-4c70-bac0-e40c6cf09833 | DHCP agent | mgt04 | az1 | :-) | UP | neutron-dhcp-agent |
| 87c80360-3495-4638-9212-f9edf0a95634 | DHCP agent | mgt06 | az1 | :-) | UP | neutron-dhcp-agent |
| e8e1aff0-772f-4f9f-9edb-7159f349fe32 | DHCP agent | mgt05 | az1 | :-) | UP | neutron-dhcp-agent |
+--------------------------------------+------------+-------+-------------------+-------+-------+--------------------+
root@mgt01:~# openstack port list --network 6a0f68ff-1382-4959-aa22-c52da91177f2

root@mgt01:~# openstack subnet set e80b4163-2308-4b3d-afe3-45992e1b652c --dhcp
root@mgt01:~# openstack port list --network 6a0f68ff-1382-4959-aa22-c52da91177f2
+--------------------------------------+------+-------------------+---------------------------------------------------------------------------+--------+
| ID | Name | MAC Address | Fixed IP Addresses | Status |
+--------------------------------------+------+-------------------+---------------------------------------------------------------------------+--------+
| 4587e5c1-fec6-4169-b2f8-eb0850b314ba | | fa:16:3e:80:f8:3d | ip_address='172.30.0.4', subnet_id='e80b4163-2308-4b3d-afe3-45992e1b652c' | ACTIVE |
| 91b8e6bd-f965-4f19-ae51-c40df34bc8f6 | | fa:16:3e:7c:89:f2 | ip_address='172.30.0.3', subnet_id='e80b4163-2308-4b3d-afe3-45992e1b652c' | ACTIVE |
| ecb6caf3-9d09-43bb-80da-61c3f6642eaf | | fa:16:3e:9f:31:04 | ip_address='172.30.0.2', subnet_id='e80b4163-2308-4b3d-afe3-45992e1b652c' | ACTIVE |
+--------------------------------------+------+-------------------+---------------------------------------------------------------------------+--------+

Besides, there is a alternative to solve it without using `reserved_dhcp_port`:

>>> network_id='6a0f68ff-1382-4959-aa22-c52da91177f2'
>>> import uuid
>>> host_uuid=uuid.uuid5(uuid.NAMESPACE_DNS, 'mgt04')
>>> print('dhcp%s-%s' % (host_uuid, network_id))
dhcp7901d681-a80e-5942-aa5d-f7c842f10b6e-6a0f68ff-1382-4959-aa22-c52da91177f2

ref: https://opendev.org/openstack/neutron/src/branch/stable/rocky/neutron/common/utils.py#L130-L136

openstack port create --network 6a0f68ff-1382-4959-aa22-c52da91177f2 --device dhcp7901d681-a80e-5942-aa5d-f7c842f10b6e-6a0f68ff-1382-4959-aa22-c52da91177f2 --device-owner network:dhcp --host mgt04 --fixed-ip subnet=e80b4163-2308-4b3d-afe3-45992e1b652c,ip-address=172.30.0.251 --disable-port-security dhcp-port-1
openstack port create --network 6a0f68ff-1382-4959-aa22-c52da91177f2 --device ${device_id_x} --devi...

Read more...

Revision history for this message
Oleg Bondarev (obondarev) wrote :

Thanks for additional info @uchenily! Unfortunately now I have no opportunity to reproduce, so putting this back to 'New' in hope someone could confirm.

Changed in neutron:
status: Incomplete → New
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.