From 787daf49b358fbe2d514012a708c28575fc8122b Mon Sep 17 00:00:00 2001
From: Radek Vykydal <rvykydal@redhat.com>
Date: Wed, 1 Jul 2020 11:25:37 +0200
Subject: [PATCH] network: fix configuration of virtual devices by boot options

The configuration was not passed to installed system via ifcfg files.

Resolves: rhbz#1851218
---
 pyanaconda/modules/network/initialization.py | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/pyanaconda/modules/network/initialization.py b/pyanaconda/modules/network/initialization.py
index de1ec851b..5e33d0494 100644
--- a/pyanaconda/modules/network/initialization.py
+++ b/pyanaconda/modules/network/initialization.py
@@ -26,7 +26,8 @@ from pyanaconda.modules.network.nm_client import get_device_name_from_network_da
     update_connection_values, commit_changes_with_autoconnection_blocked, is_ibft_connection
 from pyanaconda.modules.network.ifcfg import get_ifcfg_file_of_device, find_ifcfg_uuid_of_device, \
     get_master_slaves_from_ifcfgs
-from pyanaconda.modules.network.device_configuration import supported_wired_device_types
+from pyanaconda.modules.network.device_configuration import supported_wired_device_types, \
+    virtual_device_types
 from pyanaconda.modules.network.utils import guard_by_system_configuration
 
 log = get_module_logger(__name__)
@@ -431,8 +432,9 @@ class DumpMissingIfcfgFilesTask(Task):
             log.debug("%s: No NetworkManager available.", self.name)
             return new_ifcfgs
 
+        dumped_device_types = supported_wired_device_types + virtual_device_types
         for device in self._nm_client.get_devices():
-            if device.get_device_type() not in supported_wired_device_types:
+            if device.get_device_type() not in dumped_device_types:
                 continue
 
             iface = device.get_iface()
@@ -446,9 +448,14 @@ class DumpMissingIfcfgFilesTask(Task):
 
             device_is_slave = any(con.get_setting_connection().get_master() for con in cons)
             if device_is_slave:
-                log.debug("%s: not creating default connection for slave device %s",
-                          self.name, iface)
-                continue
+                # We have to dump persistent ifcfg files for slaves created in initramfs
+                if n_cons == 1 and self._is_initramfs_connection(cons[0], iface):
+                    log.debug("%s: device %s has an initramfs slave connection",
+                              self.name, iface)
+                else:
+                    log.debug("%s: not creating default connection for slave device %s",
+                              self.name, iface)
+                    continue
 
             # Devices activated in initramfs should have ONBOOT=yes
             has_initramfs_con = any(self._is_initramfs_connection(con, iface) for con in cons)
-- 
2.23.0

