From 7e34c08e96edb73fc64a51678da50604179ddb41 Mon Sep 17 00:00:00 2001 From: Eric MacDonald Date: Tue, 9 Apr 2024 13:00:22 +0000 Subject: [PATCH] Add pxeboot network hostname resolution for controllers Worker and storage nodes currently support pxeboot-N hostname nslookup resolution because they dhcp for their pxeboot network lease address provided by dnsmasq persists. However, this is not true for the controllers. Although they may initially dhcp for a pxeboot address, that address is overridden by their statically assigned pxeboot network address(es). Adding the controller pxeboot network hostnames and addresses to the dnsmasq.addn_hosts file yields proper pxeboot hostname resolution for controllers. From Controllers: [sysadmin@controller-0 ~$ nslookup pxeboot-2 Server: fdff:10:80:27::2 Address: fdff:10:80:27::2#53 Name: pxeboot-2 Address: 192.168.202.3 [sysadmin@controller-0 ~$ nslookup pxeboot-1 Server: fdff:10:80:27::2 Address: fdff:10:80:27::2#53 Name: pxeboot-1 Address: 192.168.202.2 sysadmin@controller-1:~$ nslookup pxeboot-1 Server: fdff:10:80:27::2 Address: fdff:10:80:27::2#53 Name: pxeboot-1 Address: 192.168.202.2 sysadmin@controller-1:~$ nslookup pxeboot-2 Server: fdff:10:80:27::2 Address: fdff:10:80:27::2#53 Name: pxeboot-2 Address: 192.168.202.3 From Worker: sysadmin@worker-0:~$ nslookup pxeboot-1 Server: 192.168.204.1 Address: 192.168.204.1#53 Name: pxeboot-1 Address: 169.254.202.2 Now all hosts in the system support pxeboot hostname nslookup Also, this update adds an explicit call to _generate_dnsmasq_hosts_file to the conductor process restart. This handles the case where dnsmasq publishes a new lease to handle while the sysinv conductor is not running or being restarted. Test Plan: PASS: Verify build and install AIO DX Plus system. PASS: Verify format of new additions to dhsmasq.addn_hosts file. PASS: Verify nslookup using controller pxeboot hostnames from either controller or even a worker node. PASS: Verify no new pep8 warnings or errors are added to the conductor manager.py. Story: 2010940 Task: 49829 Change-Id: Ibacdaadd24cf8c73fec98167d4a79fece341b1e6 Signed-off-by: Eric MacDonald --- sysinv/sysinv/sysinv/sysinv/conductor/manager.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sysinv/sysinv/sysinv/sysinv/conductor/manager.py b/sysinv/sysinv/sysinv/sysinv/conductor/manager.py index c1283c27cb..276cf354fb 100644 --- a/sysinv/sysinv/sysinv/sysinv/conductor/manager.py +++ b/sysinv/sysinv/sysinv/sysinv/conductor/manager.py @@ -1507,6 +1507,13 @@ class ConductorManager(service.PeriodicService): LOG.info("%s: adding '%s' from database to %s" % ( func, line.strip(), dnsmasq_hosts_file)) f_out.write(line) + + # Also add a line to dnsmasq.addn_hosts for dnslookup + # of the static (non-dhcp'ed) controller pxeboot hostnames. + hostname_internal = pxeboot_hostname + "." + constants.INTERNAL_DOMAIN + addn_line_internal = self._dnsmasq_addn_host_entry_to_string( + address.address, hostname_internal, [pxeboot_hostname]) + f_out_addn.write(addn_line_internal) break # When the leases file exists, parse it looking for