From 4d6464669976012a6db976cf908dad6af48d7073 Mon Sep 17 00:00:00 2001
From: Mark Goddard <mark@stackhpc.com>
Date: Thu, 13 Dec 2018 14:07:41 +0000
Subject: [PATCH] Set [pxe] tftp_server in ironic.conf

The ironic TFTP server should be accessed via the internal API network.
For ironic inspector, dnsmasq.conf advertises this correctly:

dhcp-option=option:tftp-server,'api_interface_address'
dhcp-option=option:server-ip-address,'api_interface_address'

However, ironic conductor does not set the [pxe] tftp_server variable.
This means the TFTP server advertised gets the default value of $my_ip,
which is set by
https://docs.openstack.org/oslo.utils/latest/reference/netutils.html#oslo_utils.netutils.get_my_ipv4,
typically the source IP for the default route.

This change sets [pxe] tftp_server to 'api_interface_address'.

Change-Id: Ic3e688b3f2b92ad9515322f49cd5f4f29d763e49
Closes-Bug: #1808347
---
 ansible/roles/ironic/templates/ironic.conf.j2 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ansible/roles/ironic/templates/ironic.conf.j2 b/ansible/roles/ironic/templates/ironic.conf.j2
index 96620d19f5..c21b8b1e21 100644
--- a/ansible/roles/ironic/templates/ironic.conf.j2
+++ b/ansible/roles/ironic/templates/ironic.conf.j2
@@ -118,6 +118,7 @@ pxe_config_template = $pybasedir/drivers/modules/ipxe_config.template
 uefi_pxe_config_template = $pybasedir/drivers/modules/ipxe_config.template
 tftp_root = /httpboot
 tftp_master_path = /httpboot/master_images
+tftp_server = {{ api_interface_address }}
 {% endif %}
 
 {% if enable_ironic_ipxe | bool %}