summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2019-06-17 02:56:54 +0000
committerGerrit Code Review <review@openstack.org>2019-06-17 02:56:54 +0000
commitdb7bab8af6742d082c24df52f6e380c2bd452210 (patch)
treee94e9dc8b8227f12b2bb84047111445816081279
parentd68d6dc71d8e093b43f12534ac00a0af7ca3c2ce (diff)
parent2fde1940b5a5a6624ed7a2dadf609eb2a80530cd (diff)
downloadironic-db7bab8af6742d082c24df52f6e380c2bd452210.tar.gz
Merge "Remove ipxe tags when ipx6 is in use."
-rw-r--r--ironic/common/pxe_utils.py29
-rw-r--r--ironic/tests/unit/common/test_pxe_utils.py14
-rw-r--r--releasenotes/notes/remove-ipxe-tags-with-ipv6-cf4b7937c27590d6.yaml6
3 files changed, 23 insertions, 26 deletions
diff --git a/ironic/common/pxe_utils.py b/ironic/common/pxe_utils.py
index 901d81d91..e6b2586d9 100644
--- a/ironic/common/pxe_utils.py
+++ b/ironic/common/pxe_utils.py
@@ -470,19 +470,22 @@ def dhcp_options_for_instance(task, ipxe_enabled=False, url_boot=False):
# added in the Stein cycle which identifies the iPXE User-Class
# directly and is only sent in DHCPv6.
- # NOTE(TheJulia): Lets send both, let neutron tag/sort it out as
- # an ip_version field is also transmitted. Plus, given the
- # semi-obscure nature of this, being more verbose and letting
- # the DHCP server do the best thing possible is likely the best
- # course of action.
- dhcp_opts.append({'opt_name': "tag:!ipxe,%s" % boot_file_param,
- 'opt_value': boot_file})
- dhcp_opts.append({'opt_name': "tag:!ipxe6,%s" % boot_file_param,
- 'opt_value': boot_file})
- dhcp_opts.append({'opt_name': "tag:ipxe,%s" % boot_file_param,
- 'opt_value': ipxe_script_url})
- dhcp_opts.append({'opt_name': "tag:ipxe6,%s" % boot_file_param,
- 'opt_value': ipxe_script_url})
+ if ip_version != 6:
+ dhcp_opts.append(
+ {'opt_name': "tag:!ipxe,%s" % boot_file_param,
+ 'opt_value': boot_file}
+ )
+ dhcp_opts.append(
+ {'opt_name': "tag:ipxe,%s" % boot_file_param,
+ 'opt_value': ipxe_script_url}
+ )
+ else:
+ dhcp_opts.append(
+ {'opt_name': "tag:!ipxe6,%s" % boot_file_param,
+ 'opt_value': boot_file})
+ dhcp_opts.append(
+ {'opt_name': "tag:ipxe6,%s" % boot_file_param,
+ 'opt_value': ipxe_script_url})
else:
# !175 == non-iPXE.
# http://ipxe.org/howto/dhcpd#ipxe-specific_options
diff --git a/ironic/tests/unit/common/test_pxe_utils.py b/ironic/tests/unit/common/test_pxe_utils.py
index 6f1372ee0..b082a059a 100644
--- a/ironic/tests/unit/common/test_pxe_utils.py
+++ b/ironic/tests/unit/common/test_pxe_utils.py
@@ -857,15 +857,9 @@ class TestPXEUtils(db_base.DbTestCase):
self.config(dhcp_provider='neutron', group='dhcp')
if ip_version == 6:
# Boot URL variable set from prior test of isc parameters.
- expected_info = [{'opt_name': 'tag:!ipxe,59',
+ expected_info = [{'opt_name': 'tag:!ipxe6,59',
'opt_value': 'tftp://[ff80::1]/fake-bootfile',
'ip_version': ip_version},
- {'opt_name': 'tag:!ipxe6,59',
- 'opt_value': 'tftp://[ff80::1]/fake-bootfile',
- 'ip_version': ip_version},
- {'opt_name': 'tag:ipxe,59',
- 'opt_value': expected_boot_script_url,
- 'ip_version': ip_version},
{'opt_name': 'tag:ipxe6,59',
'opt_value': expected_boot_script_url,
'ip_version': ip_version}]
@@ -874,9 +868,6 @@ class TestPXEUtils(db_base.DbTestCase):
expected_info = [{'opt_name': 'tag:!ipxe,67',
'opt_value': boot_file,
'ip_version': ip_version},
- {'opt_name': 'tag:!ipxe6,67',
- 'opt_value': boot_file,
- 'ip_version': ip_version},
{'opt_name': '66',
'opt_value': '192.0.2.1',
'ip_version': ip_version},
@@ -886,9 +877,6 @@ class TestPXEUtils(db_base.DbTestCase):
{'opt_name': 'tag:ipxe,67',
'opt_value': expected_boot_script_url,
'ip_version': ip_version},
- {'opt_name': 'tag:ipxe6,67',
- 'opt_value': expected_boot_script_url,
- 'ip_version': ip_version},
{'opt_name': 'server-ip-address',
'opt_value': '192.0.2.1',
'ip_version': ip_version}]
diff --git a/releasenotes/notes/remove-ipxe-tags-with-ipv6-cf4b7937c27590d6.yaml b/releasenotes/notes/remove-ipxe-tags-with-ipv6-cf4b7937c27590d6.yaml
new file mode 100644
index 000000000..5e4876212
--- /dev/null
+++ b/releasenotes/notes/remove-ipxe-tags-with-ipv6-cf4b7937c27590d6.yaml
@@ -0,0 +1,6 @@
+---
+fixes:
+ - |
+ Fixes the duplication of the "ipxe" tag when using IPv6, which leads to
+ the dhcp server possibly returning an incorrect response to the DHCPv6
+ client.