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 <coxu@redhat.com>
This commit is contained in:
Coiby Xu 2023-05-16 14:43:41 +08:00
parent 1e4c637df0
commit c95039410e
1 changed files with 5 additions and 1 deletions

View File

@ -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"