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 <eric.macdonald@windriver.com>
This commit is contained in:
Eric MacDonald 2024-04-09 13:00:22 +00:00
parent 8ea80c4b27
commit 7e34c08e96
1 changed files with 7 additions and 0 deletions

View File

@ -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