Currently, kexec-tools parses legacy ifcfg-* configuration files or
NetworkManager .nmconnection connection profiles to build up dracut
command line parameters like ip=. Then dracut parses these parameters and
runs nm-initrd-generator to generate NetworkManager connection profiles.
Taking a bonding network as an example, nm-initrd-generator generates two
connections as follows,
$ /usr/libexec/nm-initrd-generator -s -- bootdev=mybond0 rd.neednet kdumpnic=mybond0 bond=mybond0:kdump-eth0
*** Connection 'mybond0' ***
[connection]
id=mybond0
uuid=ed87d02b-dd44-4f0e-8b11-37db7e89bb48
interface-name=mybond0
[ipv4]
dhcp-timeout=90
...
*** Connection 'kdump-eth0' ***
[connection]
id=kdump-eth0
uuid=ed6a7448-b5f8-4f8a-b718-3e24ea1c924b
type=ethernet
interface-name=kdump-eth0
master=ed87d02b-dd44-4f0e-8b11-37db7e89bb48
slave-type=bond
wait-device-timeout=60000
...
Later in kdump initrd, dracut starts NetworkManager to activate these
profiles to bring up the network connections. This way of setting up
kdump network is tedious, error-prone and unnecessary. A better way is
to directly copy the needed connection profiles to initrd. A potential
benefit of this approach for the users is they can simply edit the
connection profile directly like changing ipv4.dhcp-timeout instead of
being forced to use the hard-coded value enforced by
nm-initrd-generator.
This patch set reuses NetworkManager connection profiles to setup kdump
network. It also reduces the memory consumption of network drivers and
fix other issues at the same time. A machine could have multiple network
drivers and a network driver may manage multiple NICs. It's possible
kdump may only need one NIC. In this case, there is no need to install
unneeded network drivers or bring up unneeded NICs.
Here are the bug list that addressed by this patch set,
- Bug 1962421 - [RHEL-9]"eth0: Failed to rename network interface 3 from 'eth0' to 'kdump-eth0': File exists"
- Bug 2064708 - kdump: mkdumprd: failed to make kdump initrd for bridge network on z15 z/vm
- bugs related to OOM caused by network driver
- Bug 1950282 - shutdown those unneeded network interfaces to save memory for kdump
- Bug 1958587 - the kdump initramfs includes unnecessary NIC drivers for SSH/NFS dumping target
- Bug 1890021 - be2net is using too much memory during kdump
- Bug 1662202 - [RHEL-8.1] aarch64: hpe-apache crashkernel OOM when dump to network targe
v1:
- refactor complex kdump_copy_nmconnection_file [Philipp]
- clean up temporary file in a trap [Philipp]
- improve sed [Philipp]
- use long name consistently [Philipp]
- use nmcli -t, --terse option to suppress printing of the header [Philipp]
- don't pass kdumpip to initrd [Kairui]
- address the case where kdump_install_net is called multiple times like
fence kdump
- call kdump_install_nm_netif_allowlist after all kdump_install_net
calls have been finished
- ask NM to match a connection profile to a physical NIC by MAC address
- stop treating vlan specially when its parent interface is a physical NIC
- don't add unused NIC drivers to kdump initrd
- fix the error of "/etc/NetworkManager/system-connections/*.nmconnection" not exist
grep: /etc/NetworkManager/system-connections/*.nmconnection: No such file or directory
- redirect the messages of nmcli to ddebug
- use "grep -s" to get rid of the following warnings
grep: /var/tmp/dracut.6tqUm0/initramfs//etc/NetworkManager/system-connections/*.nmconnection: No such file or directory
grep: /etc/sysconfig/network-scripts/ifcfg-*: No such file or directory
grep: /etc/NetworkManager/system-connections/*.nmconnection: No such file or directory
Coiby Xu (14):
add function to copy NetworkManage connection profile to the initramfs
clone NM connection profiles to support legacy ifcfg automatically
ask NM to wait the network device to be available
stop dracut 35network-manager from running nm-initrd-generator
set up kdump network bridge by directly copying NM connection profile
to initrd
set up kdump bonding network by directly copying NM connection profile
to initrd
fix error for vlan over team network interface
set up kdump vlan network by directly copying NM connection profile to
initrd
set up kdump teaming network by directly copying NM connection profile
to initrd
clean up unneeded code after copying .nmconnection to initrd
reduce kdump memory consumption by not letting NetworkManager manage
unneeded network interfaces
reduce kdump memory consumption by only installing needed NIC drivers
address the cases where a NIC has a different name in kdump kernel
simplify setup_znet by copying connection profile to initrd
dracut-kdump.sh | 25 ++-
dracut-module-setup.sh | 484 ++++++++++++++++++-----------------------
kdump-lib-initramfs.sh | 12 +
mkdumprd | 2 +-
4 files changed, 239 insertions(+), 284 deletions(-)
--
2.35.3