From 4eaf39702339fbb6800806b6a06b0edbae41063b Mon Sep 17 00:00:00 2001
From: Zhangfei Gao <zhangfei.gao@linaro.org>
Date: Fri, 18 May 2018 16:27:06 +0800
Subject: [PATCH] Adding ironic_dnsmasq_boot_file parameter to globals.yml

By now, ironic-dnsmasq has default bootfile pxelinux.0,
which is correct only for x86.
Adding ironic_dnsmasq_boot_file parameter to globals.yml
to make it configuable.
For example: /etc/kolla/globals.yml
ironic_dnsmasq_boot_file: "debian-installer/arm64/bootnetaa64.efi"

Change-Id: I6eb57702d4dad549ef8c999c1c82e577f316d8d6
---
 ansible/roles/ironic/defaults/main.yml               |  1 +
 .../roles/ironic/templates/ironic-dnsmasq.conf.j2    |  2 +-
 doc/source/reference/ironic-guide.rst                | 12 ++++++++++++
 etc/kolla/globals.yml                                |  2 ++
 4 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/ansible/roles/ironic/defaults/main.yml b/ansible/roles/ironic/defaults/main.yml
index d20a4d0857..d2c48b57df 100644
--- a/ansible/roles/ironic/defaults/main.yml
+++ b/ansible/roles/ironic/defaults/main.yml
@@ -125,5 +125,6 @@ openstack_ironic_inspector_auth: "{{ openstack_auth }}"
 
 ironic_dnsmasq_interface: "{{ api_interface }}"
 ironic_dnsmasq_dhcp_range:
+ironic_dnsmasq_boot_file: "pxelinux.0"
 ironic_cleaning_network:
 ironic_console_serial_speed: "115200n8"
diff --git a/ansible/roles/ironic/templates/ironic-dnsmasq.conf.j2 b/ansible/roles/ironic/templates/ironic-dnsmasq.conf.j2
index f88d8f208f..48e5cf436e 100644
--- a/ansible/roles/ironic/templates/ironic-dnsmasq.conf.j2
+++ b/ansible/roles/ironic/templates/ironic-dnsmasq.conf.j2
@@ -5,5 +5,5 @@ dhcp-option=option:tftp-server,{{ api_interface_address }}
 dhcp-option=option:server-ip-address,{{ api_interface_address }}
 bind-interfaces
 dhcp-sequential-ip
-dhcp-option=option:bootfile-name,pxelinux.0
+dhcp-option=option:bootfile-name,{{ ironic_dnsmasq_boot_file }}
 dhcp-option=210,/tftpboot/
diff --git a/doc/source/reference/ironic-guide.rst b/doc/source/reference/ironic-guide.rst
index 95f0fb17d6..8cee33b746 100644
--- a/doc/source/reference/ironic-guide.rst
+++ b/doc/source/reference/ironic-guide.rst
@@ -30,6 +30,18 @@ network:
 
 .. end
 
+In the same file, specify the PXE bootloader file for Ironic Inspector. The
+file is relative to the ``/tftpboot`` directory. The default is ``pxelinux.0``,
+and should be correct for x86 systems. Other platforms may require a different
+value, for example aarch64 on Debian requires
+``debian-installer/arm64/bootnetaa64.efi``.
+
+.. code-block:: yaml
+
+   ironic_dnsmasq_boot_file: pxelinux.0
+
+.. end
+
 Ironic inspector also requires a deploy kernel and ramdisk to be placed in
 ``/etc/kolla/config/ironic/``. The following example uses coreos which is
 commonly used in Ironic deployments, though any compatible kernel/ramdisk may
diff --git a/etc/kolla/globals.yml b/etc/kolla/globals.yml
index 20455081bc..5ff0f34ba9 100644
--- a/etc/kolla/globals.yml
+++ b/etc/kolla/globals.yml
@@ -380,6 +380,8 @@ glance_enable_rolling_upgrade: "no"
 # following value must be set when enable ironic, the value format
 # is "192.168.0.10,192.168.0.100".
 ironic_dnsmasq_dhcp_range:
+# PXE bootloader file for Ironic Inspector, relative to /tftpboot.
+#ironic_dnsmasq_boot_file: "pxelinux.0"
 
 ######################################
 # Manila - Shared File Systems Options