[Ovirt-devel] [PATCH node] update filtering of nics for ovirt-config-networking

Joey Boggs jboggs at redhat.com
Thu Feb 11 16:19:28 UTC 2010


This updates the filtering model to only display nics that have kernel modules associated with them, which filters out all nonphysical devices.
---
 scripts/ovirt-config-networking |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking
index 40a2d2c..96e425f 100755
--- a/scripts/ovirt-config-networking
+++ b/scripts/ovirt-config-networking
@@ -455,7 +455,7 @@ function setup_menu
     fi
 
     # Add virtio NICs that were possibly not detected by hal
-    NICS="$NICS $(ifconfig -a | awk '/Ethernet/ {print $1}' | grep -v -E "^br|^bond|^vnet|^virbr|\." | xargs)"
+    NICS="$(ifconfig -a | awk '/Ethernet/ {print $1}'|xargs)"
     NICS=$(echo $NICS | tr ' ' '\n' | sort -u | xargs)
 
     PS3="Please select an interface or configuration option: "
@@ -481,6 +481,7 @@ else
         printf "***** WARNING *****\n"
         printf "\nPhysical Networking Devices (*=PXE boot interface)\n"
         printf " %-10s %-12s %-18s\n" "Name" "Driver" "MAC"
+        PHY_NICS=""
         for nic in $NICS; do
             driver=$(basename $(readlink /sys/class/net/$nic/device/driver) 2>/dev/null)
             mac=$(cat /sys/class/net/$nic/address)
@@ -489,14 +490,17 @@ else
             else
                 pxe=" "
             fi
-            printf "%s%-10s %-12s %-18s\n" "$pxe" "$nic" "$driver" "$mac"
+            if [ -n "$driver" ]; then
+                PHY_NICS="$PHY_NICS $nic"
+                printf "%s%-10s %-12s %-18s\n" "$pxe" "$nic" "$driver" "$mac"
+            fi
         done
 
         DNS="DNS"
         NTP="NTP"
         Abort="Abort"
         Save="Save And Return To Menu"
-        select NIC in $NICS "$DNS" "$NTP" "$Abort" "$Save"
+        select NIC in $PHY_NICS "$DNS" "$NTP" "$Abort" "$Save"
         do
             printf "\n"
             case "$NIC" in
-- 
1.6.6




More information about the ovirt-devel mailing list