Browse Source

Add dhcp options for each ip_version once

Currently duplicate DHCP options are added when a port have
multiple address in the same address familiy. The duplicate
entries cause an internal server error in neutron.

This fixes the issue by only adding DHCP options for each
IP-version.

Story: 2009774
Task: 44255
Change-Id: I8bef819dc3101f88f4e04ea986e1039e34d917ed
changes/17/823817/3
Harald Jensås 4 months ago
parent
commit
c4721da2d8
  1. 6
      ironic/dhcp/neutron.py
  2. 6
      ironic/tests/unit/dhcp/test_neutron.py
  3. 8
      releasenotes/notes/fix-duplcate-extra-dhcp-options-4edb729cb5bcf552.yaml

6
ironic/dhcp/neutron.py

@ -80,9 +80,9 @@ class NeutronDHCPApi(base.BaseDHCP):
update_opts = []
if len(fips) != 0:
for fip in fips:
ip_version = \
ipaddress.ip_address(fip['ip_address']).version
ip_versions = {ipaddress.ip_address(fip['ip_address']).version
for fip in fips}
for ip_version in ip_versions:
for option in dhcp_options:
if option.get('ip_version', 4) == ip_version:
update_opts.append(option)

6
ironic/tests/unit/dhcp/test_neutron.py

@ -165,8 +165,14 @@ class TestNeutron(db_base.DbTestCase):
{
"ip_address": "192.168.1.3",
},
{
"ip_address": "192.168.1.4",
},
{
"ip_address": "2001:db8::201",
},
{
"ip_address": "2001:db8::202",
}
],
}

8
releasenotes/notes/fix-duplcate-extra-dhcp-options-4edb729cb5bcf552.yaml

@ -0,0 +1,8 @@
---
fixes:
- |
Fixed an issue where duplicate extra DHCP options was passed in the port
update request to the Networking service. The duplicate DHCP options
caused an error in the Networking service and node provisioning would
fail. See bug:
`2009774 <https://storyboard.openstack.org/#!/story/2009774>`_.
Loading…
Cancel
Save