From c95039410e989f180e918e635c938b70dd9e479e Mon Sep 17 00:00:00 2001 From: Coiby Xu Date: Tue, 16 May 2023 14:43:41 +0800 Subject: [PATCH] Don't rename Azure Hyper-V network interface Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1964822 Upstream: RHEL-only Currently, vmcore dumping to remote fs gives a warning "eth0: Failed to rename network interface 3 from 'eth0' to 'kdump-eth0': File exists" on Azure Hyper-V VM with accelerated networking because it uses a physical NIC for accelerated networking [1] and the backing physical NIC has the same MAC as the virtual NIC. There is no need to rename a Hypver-V interface in this case which also leads the aforementioned warning. [1] https://learn.microsoft.com/en-us/azure/virtual-network/accelerated-networking-overview Signed-off-by: Coiby Xu --- dracut-module-setup.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 9cbb5d6..e250703 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -303,6 +303,10 @@ kdump_get_perm_addr() { fi } +_get_nic_driver() { + ethtool -i "$1" | sed -n -E "s/driver: (.*)/\1/p" +} + # Prefix kernel assigned names with "kdump-". EX: eth0 -> kdump-eth0 # Because kernel assigned names are not persistent between 1st and 2nd # kernel. We could probably end up with eth0 being eth1, eth0 being @@ -314,7 +318,7 @@ kdump_setup_ifname() { # fadump to kdump. Skip prefixing 'kdump-' in this case as adding # another prefix may truncate the ifname. Since an ifname with # 'kdump-' is already persistent, this should be fine. - if [[ $1 =~ eth* ]] && [[ ! $1 =~ ^kdump-* ]]; then + if [[ $1 =~ eth* ]] && [[ ! $1 =~ ^kdump-* ]] && [[ $(_get_nic_driver "$1") != hv_netvsc ]]; then _ifname="kdump-$1" else _ifname="$1"