summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2022-01-13 09:51:53 +0000
committerGerrit Code Review <review@openstack.org>2022-01-13 09:51:53 +0000
commitabee1766ac448c1f6e2ca8b0e26fd4bddc7571cc (patch)
tree9fd4d372feb76549a094b0086e47660515831176
parentddce1dc7a3670d8ad6a09483cc06c93afd0d42c1 (diff)
parentb1aa0d4c2a576140c094d9d6a41a7ac8ebd1915d (diff)
downloadironic-abee1766ac448c1f6e2ca8b0e26fd4bddc7571cc.tar.gz
Merge "Add dhcp options for each ip_version once" into bugfix/18.1
-rw-r--r--ironic/dhcp/neutron.py6
-rw-r--r--ironic/tests/unit/dhcp/test_neutron.py6
-rw-r--r--releasenotes/notes/fix-duplcate-extra-dhcp-options-4edb729cb5bcf552.yaml8
3 files changed, 17 insertions, 3 deletions
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)
diff --git a/ironic/tests/unit/dhcp/test_neutron.py b/ironic/tests/unit/dhcp/test_neutron.py
index 8d87345d2..9a1f28ddb 100644
--- a/ironic/tests/unit/dhcp/test_neutron.py
+++ b/ironic/tests/unit/dhcp/test_neutron.py
@@ -166,7 +166,13 @@ 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",
}
],
}
diff --git a/releasenotes/notes/fix-duplcate-extra-dhcp-options-4edb729cb5bcf552.yaml b/releasenotes/notes/fix-duplcate-extra-dhcp-options-4edb729cb5bcf552.yaml
new file mode 100644
index 000000000..13ce1003f
--- /dev/null
+++ b/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>`_.