7ec9e8
From 0422ba0e773d1a8257a3f2bf3db05f3bc7917eb7 Mon Sep 17 00:00:00 2001
7ec9e8
From: Eduardo Otubo <otubo@redhat.com>
7ec9e8
Date: Thu, 28 May 2020 08:44:08 +0200
7ec9e8
Subject: [PATCH 4/4] Remove race condition between cloud-init and
7ec9e8
 NetworkManager
7ec9e8
7ec9e8
RH-Author: Eduardo Otubo <otubo@redhat.com>
7ec9e8
Message-id: <20200327121911.17699-1-otubo@redhat.com>
7ec9e8
Patchwork-id: 94453
7ec9e8
O-Subject: [RHEL-7.9/RHEL-8.2.0 cloud-init PATCHv2] Remove race condition between cloud-init and NetworkManager
7ec9e8
Bugzilla: 1840648
7ec9e8
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
7ec9e8
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
7ec9e8
RH-Acked-by: Cathy Avery <cavery@redhat.com>
7ec9e8
7ec9e8
cloud-init service is set to start before NetworkManager service starts,
7ec9e8
but this does not avoid a race condition between them. NetworkManager
7ec9e8
starts before cloud-init can write `dns=none' to the file:
7ec9e8
/etc/NetworkManager/conf.d/99-cloud-init.conf. This way NetworkManager
7ec9e8
doesn't read the configuration and erases all resolv.conf values upon
7ec9e8
shutdown. On the next reboot neither cloud-init or NetworkManager will
7ec9e8
write anything to resolv.conf, leaving it blank.
7ec9e8
7ec9e8
This patch introduces a NM reload (try-reload-or-restart) at the end of cloud-init
7ec9e8
start up so it won't erase resolv.conf upon first shutdown.
7ec9e8
7ec9e8
x-downstream-only: yes
7ec9e8
7ec9e8
Signed-off-by: Eduardo Otubo otubo@redhat.com
7ec9e8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
7ec9e8
---
7ec9e8
 rhel/systemd/cloud-final.service | 4 ++--
7ec9e8
 1 file changed, 2 insertions(+), 2 deletions(-)
7ec9e8
7ec9e8
diff --git a/rhel/systemd/cloud-final.service b/rhel/systemd/cloud-final.service
7ec9e8
index f303483..05add07 100644
7ec9e8
--- a/rhel/systemd/cloud-final.service
7ec9e8
+++ b/rhel/systemd/cloud-final.service
7ec9e8
@@ -11,8 +11,8 @@ ExecStart=/usr/bin/cloud-init modules --mode=final
7ec9e8
 RemainAfterExit=yes
7ec9e8
 TimeoutSec=0
7ec9e8
 KillMode=process
7ec9e8
-ExecStartPost=/bin/echo "try restart NetworkManager.service"
7ec9e8
-ExecStartPost=/usr/bin/systemctl try-restart NetworkManager.service
7ec9e8
+ExecStartPost=/bin/echo "trying to reload or restart NetworkManager.service"
7ec9e8
+ExecStartPost=/usr/bin/systemctl try-reload-or-restart NetworkManager.service
7ec9e8
 
7ec9e8
 # Output needs to appear in instance console output
7ec9e8
 StandardOutput=journal+console
7ec9e8
-- 
7ec9e8
1.8.3.1
7ec9e8