From b1aa0d4c2a576140c094d9d6a41a7ac8ebd1915d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20Jens=C3=A5s?= Date: Fri, 7 Jan 2022 16:03:11 +0100 Subject: 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 (cherry picked from commit c4721da2d899e1c51e716577e776c6ee14e2e35e) --- ironic/dhcp/neutron.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ironic/dhcp/neutron.py') diff --git a/ironic/dhcp/neutron.py b/ironic/dhcp/neutron.py index 18ccae05c..a5cb09282 100644 --- a/ironic/dhcp/neutron.py +++ b/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) -- cgit v1.2.1