Eric MacDonald 2a2733e7b3 Update dnsmasq.hosts on every dhcp lease event and process startup
A call to _generate_dnsmasq_hosts_file is added to sysinv
conductor handle_dhcp_lease.

There are currently a number of calls to _generate_dnsmasq_hosts_file
as shown in this list.

  _create_or_update_address
  _allocate_addresses_for_host
  _unallocate_addresses_for_host
  _remove_addresses_for_host
   mgmt_ip_set_by_ihost
   reserve_ip_for_third_monitor_node
   reserve_ip_for_cinder
  _init_controller_for_upgrade

Most of these are for specific system configuration changes.
However, the introduction of the pxeboot network repurposed
the use and content of the dnsmasq.hosts file.

Given that the dnsmasq hosts file no longer maintains management
network addresses and hostname associations, the question of whether
the call to _generate_dnsmasq_hosts_file is needed for them at all
anymore. That could be discussed or commented on in this review.

Testing system responsiveness to dhcp lease changes revealed
that the dnsmasq.hosts file would only get updated when one of
the aforementioned procedures are called. In many cases it took
a long time after the leases file was updated before the change
was realized by the system through a dnamasq.hosts update.

Adding this call to every dhcp lease update makes sense in that
it makes the responsiveness of dhcp lease changes immediate.

Also, there is the possibility that a lease event is missed if it
occurs while the conductor is not running. This may occur over a
swact, patch or simply process restart by puppet.

This update addrersses this gap by adding a one time call to
_generate_dnsmasq_hosts_file in the _controller_config_active_apply
audit so that the dnsmasq hosts and addn_hosts files get update
over a conductor process restart.

Test Plan:

PASS: Build, test and install AIO DX Plus system.
PASS: Verify the dnsmasq.hosts and dnsmasq.addn_hosts files get
      updated immediately following a dnsmasq dhcp lease event
      and conductor process restart.
PASS: Verify the dnsmasq.hosts and dnsmasq.addn_hosts files get
      update over a swact.

Story: 2010940
Task: 49788
Change-Id: I8d55b865f682bd5e0e210481a9dff318baab436b
Signed-off-by: Eric MacDonald <eric.macdonald@windriver.com>
2024-04-15 17:46:55 +00:00
..