From d685233220c69528f324781968de0d9122c2bdb5 Mon Sep 17 00:00:00 2001 From: Joseph Vazhappilly Date: Fri, 28 Jun 2024 06:04:06 -0400 Subject: [PATCH] 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 --- software/software/utilities/migrate.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/software/software/utilities/migrate.py b/software/software/utilities/migrate.py index 1f07dd0d..e9078d5f 100644 --- a/software/software/utilities/migrate.py +++ b/software/software/utilities/migrate.py @@ -164,6 +164,18 @@ def migrate_helm_config(from_release, to_release): 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): """Migrates sysinv data. """ @@ -702,6 +714,10 @@ def upgrade_controller(from_release, to_release, target_port): print("Migrating helm configuration...") migrate_helm_config(from_release, to_release) + # Migrate dnsmasq config + print("Migrating dnsmasq configuration...") + migrate_dnsmasq_config(to_release) + # Migrate sysinv data. print("Migrating sysinv configuration...") migrate_sysinv_data(from_release, to_release, target_port)