6f2509
From 3b847118d283245c809172250b90a698372d7cdb Mon Sep 17 00:00:00 2001
6f2509
From: Eduardo Otubo <otubo@redhat.com>
6f2509
Date: Mon, 2 Mar 2020 10:46:35 +0100
6f2509
Subject: [PATCH 2/5] Remove race condition between cloud-init and
6f2509
 NetworkManager
6f2509
6f2509
Message-id: <20200302104635.11648-1-otubo@redhat.com>
6f2509
Patchwork-id: 94098
6f2509
O-Subject: [RHEL-7.9/RHEL-8.2.0 cloud-init PATCH] Remove race condition between cloud-init and NetworkManager
6f2509
Bugzilla: 1748015
6f2509
RH-Acked-by: Cathy Avery <cavery@redhat.com>
6f2509
RH-Acked-by: Mohammed Gamal <mgamal@redhat.com>
6f2509
6f2509
cloud-init service is set to start before NetworkManager service starts,
6f2509
but this does not avoid a race condition between them. NetworkManager
6f2509
starts before cloud-init can write `dns=none' to the file:
6f2509
/etc/NetworkManager/conf.d/99-cloud-init.conf. This way NetworkManager
6f2509
doesn't read the configuration and erases all resolv.conf values upon
6f2509
shutdown. On the next reboot neither cloud-init or NetworkManager will
6f2509
write anything to resolv.conf, leaving it blank.
6f2509
6f2509
This patch introduces a NM reload (try-restart) at the end of cloud-init
6f2509
start up so it won't erase resolv.conf upon first shutdown.
6f2509
6f2509
x-downstream-only: yes
6f2509
resolves: rhbz#1748015, rhbz#1807797 and rhbz#1804780
6f2509
6f2509
Signed-off-by: Eduardo Otubo otubo@redhat.com
6f2509
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
6f2509
---
6f2509
 rhel/systemd/cloud-final.service | 2 ++
6f2509
 1 file changed, 2 insertions(+)
6f2509
6f2509
diff --git a/rhel/systemd/cloud-final.service b/rhel/systemd/cloud-final.service
6f2509
index 739b7e3..f303483 100644
6f2509
--- a/rhel/systemd/cloud-final.service
6f2509
+++ b/rhel/systemd/cloud-final.service
6f2509
@@ -11,6 +11,8 @@ ExecStart=/usr/bin/cloud-init modules --mode=final
6f2509
 RemainAfterExit=yes
6f2509
 TimeoutSec=0
6f2509
 KillMode=process
6f2509
+ExecStartPost=/bin/echo "try restart NetworkManager.service"
6f2509
+ExecStartPost=/usr/bin/systemctl try-restart NetworkManager.service
6f2509
 
6f2509
 # Output needs to appear in instance console output
6f2509
 StandardOutput=journal+console
6f2509
-- 
6f2509
1.8.3.1
6f2509