afbb32 Simplify setup_znet by copying connection profile to initrd

Authored and Committed by Coiby Xu 2 years ago
    Simplify setup_znet by copying connection profile to initrd
    
    Resolves: bz2076416
    Upstream: Fedora
    Conflict: None
    
    commit b5577c163aff88c458d638eb7954a000f6513ddb
    Author: Coiby Xu <coxu@redhat.com>
    Date:   Thu Sep 23 15:26:00 2021 +0800
    
        Simplify setup_znet by copying connection profile to initrd
    
        /usr/lib/udev/ccw_init [1] shipped by s390utils extracts the values of
        SUBCHANNELS, NETTYPE and LAYER2 from /etc/sysconfig/network-scripts/ifcfg-*
        or /etc/NetworkManager/system-connections/*.nmconnection to activate znet
        network device. If the connection profile is copied to initrd,
        there is no need to set up the "rd.znet" dracut cmdline parameter.
    
        There are two cases addressed by this commit,
         1. znet network interface is a slave of bonding/teaming/vlan/bridging
            network. The connection profile has been copied to initrd by
            kdump_copy_nmconnection_file and it contains the info needed by
            ccw_init.
         2. znet network interface is a slave of bonding/teaming/vlan/bridging
            network. The corresponding ifcfg-*/*.nmconnection file may not contain
            info like SUBCHANNELS [2]. In this case, copy the ifcfg-*/*.nmconnection
            file that has this info to the kdump initrd. Also to prevent the copied
            connection profile from being chosen by NM, set
            connection.autoconnect=false for this connection profile.
    
        With this implementation, there is also no need to check if znet is
        used beforehand.
    
        Note
        1. ccw_init doesn't care if SUBCHANNELS, NETTYPE and LAYER2 comes from
           an active NM profile or not. If an inactive NM profile contains this
           info, it needs to be copied to the kdump initrd as well.
        2. "rd.znet_ifname=$_netdev:${SUBCHANNELS}" is no longer needed needed
           because now there is no renaming of s390x network interfaces when
           reusing NetworkManager profiles. rd.znet_ifname was introduced in
           commit ce0305d ("Add a new option 'rd.znet_ifname' in order to use it
           in udev rules") to address the special case of non-persistent
           MAC address by renaming a network interface by SUBCHANNELS.
    
        [1] https://src.fedoraproject.org/rpms/s390utils/blob/rawhide/f/ccw_init
        [2] https://bugzilla.redhat.com/show_bug.cgi?id=2064708
    
        Signed-off-by: Coiby Xu <coxu@redhat.com>
        Reviewed-by: Thomas Haller <thaller@redhat.com>
        Reviewed-by: Philipp Rudo <prudo@redhat.com>
    
    Signed-off-by: Coiby Xu <coxu@redhat.com>
    
        
file modified
+36 -59