sailesh1993 / rpms / cloud-init

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