From 980611186e993b02bbf5f69e26ab585c412e3269 Mon Sep 17 00:00:00 2001
From: Julia Kreger <juliaashleykreger@gmail.com>
Date: Wed, 30 Aug 2023 13:27:54 -0700
Subject: [PATCH] PXE: Remove DHCP option 210 from being set

Ages ago we supported pxelinux. Now, not really since it is long EOL.

And while troubleshooting bug # 2033430, we discovered we had option
210 in the DHCP payload from the server, which ended up being the
folder base path for a tftp client to self reference the structure,
but only with OVN.

Further troubleshooting with the neutron-dhcp-agent and dnsmasq
revealed we never actaully really sent that option to clients.

In other words, meaning it was always redundant. Since excess
information could be part of the problem with grub, we're removing
it.

Change-Id: Iaa2f174b6082fadcab6635ca874fc5fae2fb4842
---
 ironic/common/pxe_utils.py                      | 11 -----------
 ironic/tests/unit/common/test_pxe_utils.py      |  3 ---
 releasenotes/notes/remove-400a563030224c4f.yaml |  9 +++++++++
 3 files changed, 9 insertions(+), 14 deletions(-)
 create mode 100644 releasenotes/notes/remove-400a563030224c4f.yaml

diff --git a/ironic/common/pxe_utils.py b/ironic/common/pxe_utils.py
index a4fd438ec4..8c61e235dd 100644
--- a/ironic/common/pxe_utils.py
+++ b/ironic/common/pxe_utils.py
@@ -58,7 +58,6 @@ DHCPV6_BOOTFILE_NAME = '59'  # rfc5970
 # DHCPV6_BOOTFILE_PARAMS = '60'  # rfc5970
 DHCP_TFTP_SERVER_ADDRESS = '150'  # rfc5859
 DHCP_IPXE_ENCAP_OPTS = '175'  # Tentatively Assigned
-DHCP_TFTP_PATH_PREFIX = '210'  # rfc5071
 DHCP_SERVER_IP_ADDRESS = '255'  # dnsmasq server-ip-address
 
 DEPLOY_KERNEL_RAMDISK_LABELS = ['deploy_kernel', 'deploy_ramdisk']
@@ -562,16 +561,6 @@ def dhcp_options_for_instance(task, ipxe_enabled=False, url_boot=False,
     else:
         dhcp_opts.append({'opt_name': boot_file_param,
                           'opt_value': boot_file})
-        # 210 == tftp server path-prefix or tftp root, will be used to find
-        # pxelinux.cfg directory. The pxelinux.0 loader infers this information
-        # from it's own path, but Petitboot needs it to be specified by this
-        # option since it doesn't use pxelinux.0 loader.
-        if not url_boot:
-            # Enforce trailing slash
-            prefix = os.path.join(CONF.pxe.tftp_root, '')
-            dhcp_opts.append(
-                {'opt_name': DHCP_TFTP_PATH_PREFIX,
-                 'opt_value': prefix})
 
     if not url_boot:
         dhcp_opts.append({'opt_name': DHCP_TFTP_SERVER_NAME,
diff --git a/ironic/tests/unit/common/test_pxe_utils.py b/ironic/tests/unit/common/test_pxe_utils.py
index 190bdfb811..1e2d93bda5 100644
--- a/ironic/tests/unit/common/test_pxe_utils.py
+++ b/ironic/tests/unit/common/test_pxe_utils.py
@@ -895,9 +895,6 @@ class TestPXEUtils(db_base.DbTestCase):
             expected_info = [{'opt_name': '67',
                               'opt_value': bootfile,
                               'ip_version': ip_version},
-                             {'opt_name': '210',
-                              'opt_value': '/tftp-path/',
-                              'ip_version': ip_version},
                              {'opt_name': '66',
                               'opt_value': '192.0.2.1',
                               'ip_version': ip_version},
diff --git a/releasenotes/notes/remove-400a563030224c4f.yaml b/releasenotes/notes/remove-400a563030224c4f.yaml
new file mode 100644
index 0000000000..1ce686a772
--- /dev/null
+++ b/releasenotes/notes/remove-400a563030224c4f.yaml
@@ -0,0 +1,9 @@
+---
+other:
+  - |
+    While investigating `bug 2033430 <https://bugs.launchpad.net/ironic/+bug/2033430>`_
+    we discovered we were emitting DHCP option 210 *only* with OVN, and never
+    emitted it with dnsmasq because it was not being set previously. Our
+    internal notes also indicated this was for PXELinux support, but was
+    never actually needed. As it was excess, and redundant configuration
+    being provided to Neutron, it has been removed.