Blame SOURCES/ci-Fix-for-network-configuration-not-persisting-after-r.patch

936480
From 9969cf3eaa23398816d140b319b3277465aa4bb8 Mon Sep 17 00:00:00 2001
936480
From: Eduardo Otubo <otubo@redhat.com>
936480
Date: Fri, 6 Sep 2019 12:12:11 +0200
936480
Subject: [PATCH] Fix for network configuration not persisting after reboot
936480
936480
RH-Author: Eduardo Otubo <otubo@redhat.com>
936480
Message-id: <20190906121211.23172-1-otubo@redhat.com>
936480
Patchwork-id: 90300
936480
O-Subject: [RHEL-7.8/RHEL-8.1.0 cloud-init PATCH] Fix for network configuration not persisting after reboot
936480
Bugzilla: 1593010
936480
RH-Acked-by: Mohammed Gamal <mgamal@redhat.com>
936480
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
936480
936480
The reasons the configuration does not persist after reboot includes
936480
different aspects and they're all fixed on this patch:
936480
936480
  1) The rpm package doesn't include the systemd-generator and
936480
ds-identify. The systemd-generator is called early in the boot process
936480
that calls ds-identify to check if there's any Data Source available in
936480
the current boot. In the current use case, the Data Source is removed
936480
from the VM on the second boot, this means cloud-init should disable
936480
itself in order to keep the configuration it did in the first boot.
936480
936480
  2) Even after adding those scripts, cloud-init was still being
936480
executed and the configurations were being lost. The reason for this is
936480
that the cloud-init systemd units had a wrong dependency
936480
936480
     WantedBy: multi-user.target
936480
936480
     Which would start them every time no matter the return of
936480
ds-identify. The fix is to replace the dependency by the systemd unit to
936480
cloud-init.target, which is the main cloud-init target enabled - or in
936480
this case, disabled by ds-identify. The file cloud-init.target was also
936480
missing on rpm package.
936480
936480
After adding both scripts, the main cloud-init systemd target and
936480
adjusting the systemd dependencies the configuration persists after
936480
reboots and shutdowns.
936480
936480
Signed-off-by: Eduardo Otubo <otubo@redhat.com>
936480
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
936480
---
936480
 redhat/cloud-init.spec.template       | 15 +++++++++++++++
936480
 rhel/systemd/cloud-config.service     |  2 +-
936480
 rhel/systemd/cloud-final.service      |  2 +-
936480
 rhel/systemd/cloud-init-local.service |  2 +-
936480
 rhel/systemd/cloud-init.service       |  2 +-
936480
 rhel/systemd/cloud-init.target        |  7 +++++++
936480
 6 files changed, 26 insertions(+), 4 deletions(-)
936480
 create mode 100644 rhel/systemd/cloud-init.target
936480
936480
diff --git a/rhel/systemd/cloud-config.service b/rhel/systemd/cloud-config.service
936480
index 12ca9df..f3dcd4b 100644
936480
--- a/rhel/systemd/cloud-config.service
936480
+++ b/rhel/systemd/cloud-config.service
936480
@@ -15,4 +15,4 @@ TimeoutSec=0
936480
 StandardOutput=journal+console
936480
 
936480
 [Install]
936480
-WantedBy=multi-user.target
936480
+WantedBy=cloud-init.target
936480
diff --git a/rhel/systemd/cloud-final.service b/rhel/systemd/cloud-final.service
936480
index 32a83d8..739b7e3 100644
936480
--- a/rhel/systemd/cloud-final.service
936480
+++ b/rhel/systemd/cloud-final.service
936480
@@ -16,4 +16,4 @@ KillMode=process
936480
 StandardOutput=journal+console
936480
 
936480
 [Install]
936480
-WantedBy=multi-user.target
936480
+WantedBy=cloud-init.target
936480
diff --git a/rhel/systemd/cloud-init-local.service b/rhel/systemd/cloud-init-local.service
936480
index 656eddb..8f9f6c9 100644
936480
--- a/rhel/systemd/cloud-init-local.service
936480
+++ b/rhel/systemd/cloud-init-local.service
936480
@@ -28,4 +28,4 @@ TimeoutSec=0
936480
 StandardOutput=journal+console
936480
 
936480
 [Install]
936480
-WantedBy=multi-user.target
936480
+WantedBy=cloud-init.target
936480
diff --git a/rhel/systemd/cloud-init.service b/rhel/systemd/cloud-init.service
936480
index 68fc5f1..d0023a0 100644
936480
--- a/rhel/systemd/cloud-init.service
936480
+++ b/rhel/systemd/cloud-init.service
936480
@@ -22,4 +22,4 @@ TimeoutSec=0
936480
 StandardOutput=journal+console
936480
 
936480
 [Install]
936480
-WantedBy=multi-user.target
936480
+WantedBy=cloud-init.target
936480
diff --git a/rhel/systemd/cloud-init.target b/rhel/systemd/cloud-init.target
936480
new file mode 100644
936480
index 0000000..083c3b6
936480
--- /dev/null
936480
+++ b/rhel/systemd/cloud-init.target
936480
@@ -0,0 +1,7 @@
936480
+# cloud-init target is enabled by cloud-init-generator
936480
+# To disable it you can either:
936480
+#  a.) boot with kernel cmdline of 'cloud-init=disabled'
936480
+#  b.) touch a file /etc/cloud/cloud-init.disabled
936480
+[Unit]
936480
+Description=Cloud-init target
936480
+After=multi-user.target
936480
-- 
936480
1.8.3.1
936480