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