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

Darryl L. Pierce dpierce at redhat.com
Wed Mar 3 20:35:06 UTC 2010


On Thu, Feb 11, 2010 at 11:19:28AM -0500, Joey Boggs wrote:
> 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
> 
> _______________________________________________
> Ovirt-devel mailing list
> Ovirt-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/ovirt-devel

ACK.

-- 
Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc.
Delivering value year after year.
Red Hat ranks #1 in value among software vendors.
http://www.redhat.com/promo/vendor/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/ovirt-devel/attachments/20100303/e9ac5088/attachment.sig>


More information about the ovirt-devel mailing list