Fix dnsmasq start failure after upgrade

During upgrade using USM, host-unlock step restarts dnsmasq with new
configuration. dnsmasq fails to restart if dnsmasq.addn_conf file
is not present in the new release config path.

This change ensure dnsmasq.addn_conf is present in the new release
config path by adding it to data migration.

Test Plan:
PASS: New config folder is updated for dnsmasq after deploy start
PASS: dnsmasq starts without failure after system host-unlock

Story: 2010676
Task: 50480

Change-Id: I1796257072c95e0494cc810788313c7b2f7b3028
Signed-off-by: Joseph Vazhappilly <joseph.vazhappillypaily@windriver.com>
This commit is contained in:
Joseph Vazhappilly 2024-06-28 06:04:06 -04:00
parent 8b9d59e0e7
commit d685233220

View File

@ -164,6 +164,18 @@ def migrate_helm_config(from_release, to_release):
raise raise
def migrate_dnsmasq_config(to_release):
"""Migrates dnsmasq configuration. """
LOG.info("Migrating dnsmasq config")
# Create dnsmasq.addn_conf file if not present in to_release
conf_file = os.path.join(constants.PLATFORM_PATH, "config",
to_release, "dnsmasq.addn_conf")
if not os.path.exists(conf_file):
open(conf_file, 'a').close()
def migrate_sysinv_data(from_release, to_release, port): def migrate_sysinv_data(from_release, to_release, port):
"""Migrates sysinv data. """ """Migrates sysinv data. """
@ -702,6 +714,10 @@ def upgrade_controller(from_release, to_release, target_port):
print("Migrating helm configuration...") print("Migrating helm configuration...")
migrate_helm_config(from_release, to_release) migrate_helm_config(from_release, to_release)
# Migrate dnsmasq config
print("Migrating dnsmasq configuration...")
migrate_dnsmasq_config(to_release)
# Migrate sysinv data. # Migrate sysinv data.
print("Migrating sysinv configuration...") print("Migrating sysinv configuration...")
migrate_sysinv_data(from_release, to_release, target_port) migrate_sysinv_data(from_release, to_release, target_port)