Each network interface is manged by a NM connection. Given a network
interface name, this function will be used to copy a NetworkManager (NM)
connection profile i.e. a .nmconnection file to the kdump initramfs.
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
dracut-module-setup.sh | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 85ec1aa..40ac07e 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -349,6 +349,17 @@ kdump_setup_ifname() {
echo "$_ifname"
}
+kdump_copy_nmconnection_file() {
+ local _dev _nmconnection_file_path _nmconnection_name _initrd_nmconnection_file_path
+
+ _dev=$1
+
+ _nmconnection_file_path=${nmconnection_map[$_dev]}
+ _nmconnection_name=$(basename "$_nmconnection_file_path")
+
_initrd_nmconnection_file_path="/etc/NetworkManager/system-connections/$_nmconnection_name"
+ inst "$_nmconnection_file_path"
"$_initrd_nmconnection_file_path"
+}
+
kdump_setup_bridge() {
local _netdev=$1
local _brif _dev _mac _kdumpdev
@@ -537,6 +548,12 @@ kdump_install_net() {
local _destaddr _srcaddr _route _netdev _conpath kdumpnic
local _static _proto _ip_conf _ip_opts _ifname_opts
local _znet_netdev _znet_conpath
+ # each netowrk interface is managed by a NM connection profile
+ declare -A nmconnection_map
+
+ while IFS=: read -r _ifname _nmconn; do
+ nmconnection_map[$_ifname]="$_nmconn"
+ done <<< "$(nmcli -t -f device,filename connection show
--active)"
_destaddr=$(kdump_get_remote_ip "$1")
_route=$(kdump_get_ip_route "$_destaddr")
--
2.37.1