Created
June 22, 2022 02:54
-
-
Save thaihust/2dfd8c7a593e5bca5ef7b0fd05e34a93 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
MAX_VFS=63 | |
ixgbe_nic_list=() | |
pci_nic_list=() | |
confirmed_nic_list=() | |
numvfs_list=() | |
res="n" | |
phy_driver=ixgbe | |
echo | |
echo | |
echo "!!! IMPORTANT !!!" | |
echo "BIND ALL CURRENT VFs TO IXGBEVF BEFORE PROCEEDING" | |
echo "!!! IMPORTANT !!!" | |
echo | |
echo | |
# get all ixgbe-driven interfaces | |
interfaces=`ip -o -a link show | awk -F': ' '{print $2}' | grep -v '^lo' | sort` | |
read -d '' -r -a iface_array <<< "$interfaces" | |
for iface in "${iface_array[@]}" | |
do | |
driver=`ethtool -i "${iface}" | grep "driver:" | awk '{print $2}'` | |
if [ "$driver" = "$phy_driver" ]; then | |
ixgbe_nic_list+=("$iface") | |
fi | |
done | |
echo "Detected devices:" | |
echo " ${ixgbe_nic_list[@]}" | |
echo "-------" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment