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